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

168
Views
add/remove dropdown + chosen plugin that depend on the selected dropdown

As Image below,

Image

I am trying to create a form that contains dropdown(task type) + dependent chosen plugin (task name) that the user can add or remove. The dropdown and dependent have the same class to get the value. I dint put id to avoid complicity due to the multiple same id. The option for the task type dropdown is added using the code below :

 $.each(task_type, (key, val) => {
      $(".s-type").append(
        $("<option>", {
          value: val.val,
          text: val.text,
        })
      );
  });

So the problem is, this code will append the previous dropdown too. I have tried to check if the option is already in the dropdown, but the problem is, it detects the 1st dropdown, it dint not detect other dropdowns. So the result ends up only 1st dropdown has an option, other don't have. So how to avoid this duplicate in the dropdown.

The next problem is I don't know how to get the value of the dropdown task type. I know how to get all the value dropdowns. but I don't know how to get the drop-down that changes, to change the option in the task name dropdown. If I use the class, it just detects the 1st dropdown task type.

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!