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

126
Views
Jquery enable/disable button based on multiple conditions and selectors

Let say I have a button where it can be click only:

  • When user select 1 from dropdown, input for (1) is enabled and he must fill input 1 before he can click the update button, or,
  • When user select 2 from dropdown, input for (2) is enabled and he must fill input 2 before he can click the update button, or,
  • When user select 3 from dropdown, he can straight click the update button.

My best approach is only for disable the button and the inputs, I don't know how to enable it based on multiple conditions above, please help.

$(document).ready(function($){
  $(".button-class, .input-1-class, .input-2-class").prop("disabled", true);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="input-wrap">
  <select class="select-class">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
  </select>
</div>

<div class="input-wrap">
<label>Input for 1</label>
  <input class="input-1-class">
</div>

<div class="input-wrap">
<label>Input for 2</label>
  <input class="input-2-class">
</div>

<button type="button" class="button-class">Submit</button>

about 4 years ago · Juan Pablo Isaza
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!