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

296
Vistas
Why my Select2 initialization looks different with the same function?

I am using javascript to create and animate an html form. Due to action on it, some fields are displayed or not. Some content are dynamically created. I am trying to initialize a select2 after his dynamic creation. I have developped different function.

First of all, the initializeSelect2(element) has you can see below :

enter image description here

This function helps me to initialize different select with same specs.

When I reached my page, an .each() function loop on my select2 to apply the initialization.

enter image description here

So we can get on my web page this view :

enter image description here

So, when you choose an element, some fields are append dynamically to the form. For this, there is a function that created html content, and an other that display these fields on the DOM. When some new content is append, I do the initializeSelect2() function. And surprise, the view of my select on the web page is not the same. As you can see below :

enter image description here

First, i was thinking it was a question of time. Between the moment when the content is created and the moment when the init is doing. But it not seems to be that.

I tried to move the function somewhere else but i always get the same problem. Either the init does not work or the init looks different.

Please if you know a solution or maybe an idea which can help me. Thank you

about 4 years ago · Juan Pablo Isaza
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