Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Unanswered

JQuery to match 2 number fields

(0) ShareShare
ReportReport
Posted on by

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();

 });
});

 

  • Fubar Profile Picture
    7,964 Super User 2025 Season 1 on at
    Re: JQuery to match 2 number fields

    You need to compare the values of the fields (at the moment you are comparing the 2 objects).

    eg.
     var FirstSSN = $("new_last4ssn").val();
    

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43