how to disable submit button with jquery how to disable submit button with jquery jquery jquery

how to disable submit button with jquery


The W3C recommends to set that attribute to disabled="disabled", so:

$('#submit_postcode').attr('disabled', 'disabled');

Re-enabling can be done by removing the attribute:

$('#submit_postcode').removeAttr('disabled');

Setting the attribute to any value causes it to be disabled, even .attr('disabled', 'false'), so it has to be removed.


$('#submit_postcode').attr('disabled', 'disabled');


If the check matches you return true, and if it doesn't match … you also return true. The return false line is never reached.

You probably want to change one of your trues to false, and eliminate the line outside the if/else block.