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

230
Vistas
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 Respuestas
Responde la pregunta

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