$(document).ready(function() { $("#submit").prop('disabled', true); }); $('#rnpass').change(function() { if ($('#rnpass').val() == $('#npass').val()) { $('#warn').html('
Woo, the passwords match!
'); $("#submit").prop('disabled', false); // show submit button } if ($('#rnpass').val() != $('#npass').val()) { $('#warn').html('
Those passwords don\'t match :(
'); $("#submit").prop('disabled', true); // hide submit button } });