I have the field for the new password reading the regular expressions fine.
But for some reason the re-enter new password field is not doing a compare.
Submit button should be hidden until compare comes back true. Otherwise remains hidden. If the passwords don't match, the message should come back if passwords not equal are true.
Two Fields were used:
field 1 class: pwd
field 2 class: repwd
$(document).ready(function () { $('input.Submit').hide(); $('.repwd input').on('blur', function() { var password = document.getElementById(".pwd").value; var repassword = document.getElementById(".repwd").value; if (password != repassword){ $('<p>Does not Match Password.</p>').insertAfter('.repwd'); $('input.Submit').hide(); } else{ $('input.Submit').show(); } }); $('.pwd input').on('blur', function() { var minMaxLength = /^[\s\S]{8,30}$/; var upper = /[A-Z]/; var lower = /[a-z]/; var number = /[0-9]/; var special = /[^A-Za-z0-9]/; var count = 0; $('p.complexityWarning').remove(); $('p.lengthWarning').remove(); if (minMaxLength.test($(this).val())) { $('p.lengthWarning').remove(); if (upper.test($(this).val())) count++; if (lower.test($(this).val())) count++; if (number.test($(this).val())) count++; if (special.test($(this).val())) count++; if (count < 3) { $('<p class="complexityWarning">The password does not meet the complexity requirements.</p>').insertAfter('.pwd'); // $('.Submit').attr('disabled', true); } else { $('p.complexityWarning').remove(); // $('.Submit').removeAttr('disabled'); } } else { if (upper.test($(this).val())) count++; if (lower.test($(this).val())) count++; if (number.test($(this).val())) count++; if (special.test($(this).val())) count++; if (count < 3) { $('<p class="complexityWarning">The password does not meet the complexity requirements.</p>').insertAfter('.pwd'); } else { $('p.complexityWarning').remove(); } $('<p class="lengthWarning">The password is not between 8 and 30 characters.</p>').insertAfter('.pwd'); // $('.Submit').attr('disabled', true); } }); });