Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

133
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda