Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda