0
我有我的Dropdownbox名单.cshtml
如下:asp.net mvc的显示/隐藏DIV时Dropdownbox选项更改
<div class="form-group">
@Html.Label("Role", new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.DropDownList("Name", null, new { @class = "form-control" })
</div>
</div>
这是我第一次和第二div
。
<div class="StudentSection" style="display:none;">
Some contents
</div>
<div class="LecturerSection" style="display:none;">
Some contents
</div>
在.js
<script type="text/javascript">
$(document).ready(function() {
$("#StudentSection").hide();
$("#LecturerSection").hide();
$("#Name").change(function() {
if ($("#Name").val() == "Student") {
$("#StudentSection").show();
$("#LecturerSection").hide();
}
else {
$("#LecturerSection").show();
$("#StudentSection").hide();
}
});
});
</script>
这些代码不为我的作品提供了我的代码。
Thanksss了很多! :)这帮助我了! – H2O
apvote答案,如果它帮助:) – jafarbtech