0
这是我的代码隐藏字段设置如果复选框已经被选中并保存在数据库中,如果没有选中,则显示字段设置
<div class="editor-label" style="width: 110px;">
<%: Html.LabelForEx(model => model.foo.f1) %>
</div>
<div class="editor-field" style="width: 60px; padding-top: 0;">
<%: Html.CheckBoxFor(x => x.foo.f1) %>
</div>
我想隐藏这个div:
<div id = "newid"> </div>
使用该脚本
$(function() {
$('#SecurityVulnerability_SecurityVulnerability').change(function() {
if ($(this).attr('checked')) {
$('#Security_AndroidPartnerBulletin').show();
} else {
$('#Security_AndroidPartnerBulletin').hide();
}
});
});
这只是工作,如果复选框不是已经检查过。 如果复选框已经被选中,那么我怎么写我的JS。
其工作正常,但我的CheckBox的位置自动改变。 –
这就是我的代码做的 – mplungjan
SecurityVulnerability_SecurityVulnerability这是我的复选框ID。早些时候,它接近这样的标签:filed1 []。但现在它像UI –