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

121
Views
Cómo habilitar el cuadro desplegable en el cambio de valor en el área de texto de la persona

Tengo un menú desplegable deshabilitado por defecto. Quiero habilitarlo cuando el campo de persona del área de texto no esté vacío.

Cuando se elimina el valor del campo de persona del área de texto, el campo desplegable debe vaciarse y deshabilitarse.

Código actual que no funciona:

 $('[id*="DDL"]').prop('disabled', true); $('[id*="User"]').click(function () { if (!$(this).is(":empty")) { $('[id*="DDL"]').prop('disabled', false); } else { $('#DDL').prop('selectedIndex', 0); $('[id*="DDL"]').prop('disabled', true); } });

¿Qué estoy haciendo mal aquí?

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

0

Digamos que tienes este HTML

 <textarea name="hello"></textarea> <!-- Example name = hello --> <select name="DDL" id="DDL" disabled></select> <!-- Dropdown -->

En su archivo js, puede capturar si el usuario escribe algo en el área de texto usando keyup , validar si ese área de texto está vacía y luego hacer algo si lo está

jQuery

 $(document).on("keyup","[name=hello]", function () { if($("#DDL").val() == ""){ // Check if textarea is empty $("#DDL").prop("disabled", false); // Remove disabled attrib // Do things here } });
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!