Hello smart folks,
my scenario is , customer open a page has 2 fields only:
1- Last 4 SSN
2- Renter Last 4 SSN
I want to:
1-make sure both entry matches, if not then show error message
2- hide submit button until validation successful (#1 is true)
can someone tell me why my codes doesnt work?
$(document).ready(function () {
$("#UpdateButton").hide();
$('#new_last4ssn').change(function () {
var FirstSSN = $("new_last4ssn");
var SecondSSN = $("new_reenterlast4ssn");
if (SecondSSN == FirstSSN) {
return true;
document.getElementById('#UpdateButton').style.visibility = 'visible';
}
alert("Please enter matching numbers !");
return false;
$("#UpdateButton").hide();
});
});
You need to compare the values of the fields (at the moment you are comparing the 2 objects).
eg.
var FirstSSN = $("new_last4ssn").val();
Fubar
69
Super User 2025 Season 1
oliver.rodrigues
49
Most Valuable Professional
Jon Unzueta
43