Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8519321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:12:59+00:00 2026-06-11T06:12:59+00:00

I have a script to automatically tell people when their new passwords match (account

  • 0

I have a script to automatically tell people when their new passwords match (account activation) but I need to find a way to get it to enable the submit button as well.

Here is my code:

JS:

function checkPasswordMatch() {
    var password = $("#new_password").val();
    var confirmPassword = $("#new_password2").val();

    if (password != confirmPassword) $("#divCheckPasswordMatch").html("<font color=\"red\"><b>Check Passwords</b></font>");
    else $("#divCheckPasswordMatch").html("<font color=\"green\"><b>Passwords Match</b></font>");
}

$(document).ready(function() {
    $("#txtConfirmPassword").keyup(checkPasswordMatch);
});​

HTML

<table>
    <form action="activate_account.php" method="post">
        <tr>
            <td align="right">
                <label for="new_password">Password (6-12 chars):</label>
            </td>
            <td>
                <input type="password" name="new_password" id="new_password" />
            </td>
        </tr>
        <tr>
            <td align="right">
                <label for="new_password2">Again:</label>
            </td>
            <td>
                <input type="password" name="new_password2" id="new_password2" onkeyup="checkPasswordMatch();"
                />
            </td>
        </tr>
        <tr>
            <td>
                <td>
                    <div class="registrationFormAlert" id="divCheckPasswordMatch"></div>
                </td>
                <td>
                    <div id="submit">
                        <input type="submit" value="Activate Account" disabled="disabled" />
                    </div>
                </td>
        </tr>
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:13:01+00:00Added an answer on June 11, 2026 at 6:13 am

    You must do this:

    $("#buttonActivate").prop("disabled", false);  // to enable the button
    

    Afterwards don’t forget to use this code, if a user decides to change the password again, so your button would get inactive again

     $("#buttonActivate").prop("disabled", true); // to disablethe button
    

    Just replace your current code with this one but don’t forget to update HTML as well:

    jQuery

    $(document).ready(function() {
    function checkPasswordMatch() {
        var password = $("#new_password").val();
        var confirmPassword = $("#new_password2").val();
    
        if (password != confirmPassword) {
            $("#new_password").css("background", "red");
            $("#new_password2").css("background", "red");
            $("#buttonActivate").prop("disabled", true);
            return false;
        } else {
            $("#new_password").css("background", "green");
            $("#new_password2").css("background", "green");
            $("#buttonActivate").prop("disabled", false);
            return true;
        }
    }
      $("input").keydown(function() {
        var password = $("#new_password").val();
        var confirmPassword = $("#new_password2").val();
        if (password.length >= 6 && confirmPassword.length >= 6) {  // let's check if the password is >= 6 otherwise there is nothing to check
            checkPasswordMatch();
        }
    });
    

    See updated HTML in the example below:

    1. Set an ID to your <form>, let’s say id="accountActivation";
    2. Change your input button to button and set an id to it as well:
      <button id="buttonActivate" type="submit" disabled="disabled">Activate Account</button>

    jsFiddle Working Example

    Updated jsFiddle to show Passwords mismatch warning

    I believe it will work for you right!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to have a script automatically transform an xml file into several html
I have a script that automatically populates a mysql database with data every hour.
I have developed a Powershell script that needs to be run automatically daily. This
I wish to automatically enter a password while running an install script. I have
I need to have script.sh , that would create files f1.txt and f2.txt with
I have this script to automatically map network drives: On Error Resume Next Set
I'm trying to write a simple PHP script which automatically sets up new etherpads
I have a script that is automatically adding IP addresses to my.htaccess file based
I'm extremely new to rational tools. I have a script recorded and its ready
I have written a script which automatically allows to scroll the li elements from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.