We are using MVC popup model where having two text box SSN number and DOB(Date of birth), i am using datepicker calendar for DOB and it is read only text box, for SSN number i am manually put the number in text box. i have written the below code to enable next button when SSN number and DOB both are correct. But below code is not working properly, First i put the SSN number and When i Select the DOB using calendar, next button is not enable, Please help me to resolve this issue.
$("#SocialSecurityNumber").blur(function () {
if ($("#SocialSecurityNumber").val().length == 11 && $("#DateofBirth").val() != '') {
$("#nextSubmit").removeAttr("disabled");
$("#nextSubmit").removeClass("btn-default").addClass("btn-primary");
}
else {
$("#nextSubmit").attr("disabled", true);
$("#nextSubmit").removeClass("btn-primary").addClass("btn-default");
}
});
$("#SocialSecurityNumber").keyup(function () {
if ($("#SocialSecurityNumber").val().length == 11 && $("#DateofBirth").val() != '') {
$("#nextSubmit").removeAttr("disabled");
$("#nextSubmit").removeClass("btn-default").addClass("btn-primary");
}
else {
$("#nextSubmit").attr("disabled", true);
$("#nextSubmit").removeClass("btn-primary").addClass("btn-default");
}
});
$("#DateofBirth").blur(function () {
if ($("#DateofBirth").val() !='' && $("#SocialSecurityNumber").val().length == 11) {
$("#nextSubmit").removeAttr("disabled");
$("#nextSubmit").removeClass("btn-default").addClass("btn-primary");
}
else {
$("#nextSubmit").attr("disabled",true);
$("#nextSubmit").removeClass("btn-primary").addClass("btn-default");
}
});
$("#DateofBirth").keyup(function () {
if ($("#SocialSecurityNumber").val().length == 11 && $("#DateofBirth").val() != '') {
$("#nextSubmit").removeAttr("disabled");
$("#nextSubmit").removeClass("btn-default").addClass("btn-primary");
}
else {
$("#nextSubmit").attr("disabled",true);
$("#nextSubmit").removeClass("btn-primary").addClass("btn-default");
}
});
Thanks, Sandeep
SSNnext button will not be enabled as theDOBfield is empty. 2.If the user had enteredSSNand enter theDOB(not select the date by any plugin askeyupandblurwill not work butonChangemight) then the next button will be enabled.