My login page have three things:
- Field for the username
- Field for the password
- Submit button
This code will disable the submit button if the username field is not empty.
I want to disable the submit button until the username field is filled with a email.
Additionally, After wrote something in the username field and clear it, the submit button does not disable itself. I want the submit button to disable itself after clearing the username field.
$(':input[type="submit"]').prop('disabled', true);
$('input[type="email"]').keyup(function() {
if($(this).val() != '<!-- not sure what to put here -->') {
$(':input[type="submit"]').prop('disabled', false);
}
});