Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
Submit button enabled however when user enter input oldpassword it become disabled till reconfirm password how?

I would like to enable submission due to condition while also when the user input in the old password field the button become disable till when the user enter the confirm password input the button become enabled again

Here is my attempt

$('input[name=validationoldpassword]').keyup(function() {
  // not empty button is disable
  if ($(this).val() !== '') {
    $(':button[type="submit"]').prop('disabled', true);

  } else {
    $(':button[type="submit"]').prop('disabled', true);
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="form-group row">
  <label for="validationpassword" class="col-form-label oldpasswordadduser">Old<br>&#10;Password:</label>
  <div class="col-6 d-flex">
    <input name="validationoldpassword" type="password" class="form-control oldpass" id="oldpasswords" placeholder="Password">
  </div>
</div>


<div class="form-group row">
  <label for="validationpassword" class="col-form-label passwordadduser">Password:</label>
  <div class="col-6 d-flex">
    <input name="validationpassword" type="password" class="form-control pass" id="passwords" placeholder="Password" pattern="^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{7,}$" title="Password should be like this. e.g. A123de!123">


    <div class="form-group row">
      <label for="validationconfirmpassword" class="col-form-label passwordadduser">Re-enter<br>&#10;Password:</label>
      <div class="col-6 d-flex">
        <input name="validationconfirmpassword" type="password" class="form-control confirmpass" id="confirm_password" placeholder="Confirm Password">
      </div>
    </div>

    <button id="submitbtn" type="submit" class="btn-primary submitbutton">Done</button>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to delegate

$('#container').on("input", function() {
  const empty = $('[type=password]').filter(function() {
    return $(this).val().trim() === "";
  }).length > 0
  $(':button[type="submit"]').prop('disabled', empty);
}).trigger("input")
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="container">
  <div class="form-group row">
    <label for="validationpassword" class="col-form-label oldpasswordadduser">Old<br>&#10;Password:</label>
    <div class="col-6 d-flex">
      <input name="validationoldpassword" type="password" class="form-control oldpass" id="oldpasswords" placeholder="Password">
    </div>
  </div>


  <div class="form-group row">
    <label for="validationpassword" class="col-form-label passwordadduser">Password:</label>
    <div class="col-6 d-flex">
      <input name="validationpassword" type="password" class="form-control pass" id="passwords" placeholder="Password" pattern="^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{7,}$" title="Password should be like this. e.g. A123de!123">


      <div class="form-group row">
        <label for="validationconfirmpassword" class="col-form-label passwordadduser">Re-enter<br>&#10;Password:</label>
        <div class="col-6 d-flex">
          <input name="validationconfirmpassword" type="password" class="form-control confirmpass" id="confirm_password" placeholder="Confirm Password">
        </div>
      </div>

      <button id="submitbtn" type="submit" class="btn-primary submitbutton">Done</button>
    </div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!