Jquery EditorFor复选框始终返回false
HTML:Jquery EditorFor复选框始终返回false,jquery,checkbox,Jquery,Checkbox,HTML: <div class="editor-label"> <%: Html.LabelFor(model => model.IsFeatured)%> </div> <div id="IsFeatured" class="editor-field textbox"> <%: Html.EditorFor(model => model.IsFeatured)%> <%: Html.V
<div class="editor-label">
<%: Html.LabelFor(model => model.IsFeatured)%>
</div>
<div id="IsFeatured" class="editor-field textbox">
<%: Html.EditorFor(model => model.IsFeatured)%>
<%: Html.ValidationMessageFor(model => model.IsFeatured)%>
为什么即使选中复选框,我也总是得到false
<div class="editor-label">
<%: Html.LabelFor(model => model.IsFeatured)%>
</div>
<div id="IsFeatured" class="editor-field textbox">
<%: Html.EditorFor(model => model.IsFeatured)%>
<%: Html.ValidationMessageFor(model => model.IsFeatured)%>
<div class="editor-label">
<%: Html.LabelFor(model => model.IsFeatured)%>
</div>
<div id="IsFeatured" class="editor-field textbox">
<%: Html.EditorFor(model => model.IsFeatured)%>
<%: Html.ValidationMessageFor(model => model.IsFeatured)%>
因为#IsFeatured
是一个div而不是一个复选框try
<div class="editor-label">
<%: Html.LabelFor(model => model.IsFeatured)%>
</div>
<div id="IsFeatured" class="editor-field textbox">
<%: Html.EditorFor(model => model.IsFeatured)%>
<%: Html.ValidationMessageFor(model => model.IsFeatured)%>
var IsFeatured = $('#IsFeatured input[type="checkbox"]').is(':checked');