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

114
Views
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 answers
Answer question

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