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

229
Visualizações
How To Avoid Select2 Triggering Change, but fix the option to particular value from the database?

I have a problem with select2 jquery. I want to fix the option to a particular option when it populates data from the database. But I don't want to use the change because there are other events tied to it. Is there any possibility to fix an option in select2 without triggering the change?

The current code is like this. But I don't want to trigger the change.

$('.roles').val(v).attr("old", v).attr('rowid', dc.id).trigger("change.select2");
     
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I solved the issue. I had to reinitialize the select box after setting the value like the following

$('.roles').val(3);

$(".roles").select2({
      minimumResultsForSearch: -1,
      
    })
about 4 years ago · Juan Pablo Isaza Relatório
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