I have a form and I wanted to disable the submit button unless the required fields are filled.
So I added this:
$('#submitBtn').attr('disabled', true); if ($('#inputMobile').val() != '' && $('#inputEmail').val() != '' && $('#inputPassword').val() != '' && $('#inputPasswordConfirmation').val() != '') { $('#submitBtn').attr('disabled', false); } Now it works fine and disable the submit button when the page loads but when I fill in the form fields, it does not enable the button however I tried setting the disabled attr to false.
So what's going wrong here? How can I solve this issue?