Reputation: 55
how do I make the textbox that required equal to false in this code
$(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;
}
});
});
Upvotes: 0
Views: 247
Reputation: 7220
Are you talking about this?
$("#myform").validate({
rules: {
field: "required"
}
});
Upvotes: 0
Reputation: 630569
It's .required
, lower-case, and you can simplify your code further as well since you're dealing with booleans, like this:
$(document).ready(function () {
$("#<%= chkSpecialIntegration.ClientID %>").click(function () {
$("#<%= ddlTypeSpecialIntegration.ClientID %>").toggle(this.checked);
document.getElementById('<%=txtTotalScoreDebit.ClientID %>').required = !this.checked;
});
});
Upvotes: 1