在此代码中,如何使所需的文本框等于false
$(document).ready(function () {
$("#<%= chkSpecialIntegration.ClientID %>").click(function () {
if (this.checked) {
$("#<%= ddlTypeSpecialIntegration.ClientID %>").show();
document.getElementById('<%=txtTotalScoreDebit.ClientID %>').Required = false; }
else{
$("#<%= ddlTypeSpecialIntegration.ClientID %>").hide();
document.getElementById('<%=txtTotalScoreDebit.ClientID %>').Required = true;
}
});
});发布于 2010-12-28 18:48:59
它是.required,小写,您还可以进一步简化您的代码,因为您正在处理布尔值,如下所示:
$(document).ready(function () {
$("#<%= chkSpecialIntegration.ClientID %>").click(function () {
$("#<%= ddlTypeSpecialIntegration.ClientID %>").toggle(this.checked);
document.getElementById('<%=txtTotalScoreDebit.ClientID %>').required = !this.checked;
});
});You can test it out here。
发布于 2010-12-28 18:50:30
你是在说this吗?
$("#myform").validate({
rules: {
field: "required"
}
});https://stackoverflow.com/questions/4545444
复制相似问题