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

115
Vistas
How to enable dropdown box on value change in person textarea

I have a dropdown disabled by default. I want to enable it when the the textarea person field is not empty.

When the textarea person field value is removed, the dropdown field should be emptied and disabled.

Current code which is not working:

    $('[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);
        }
});

What am I doing wrong here?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Let's say you have this HTML

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

In your js file, you can capture if the user types something on the textarea by using keyup, validate if that textarea is empty then do something if it is

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 Denunciar
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