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

251
Visualizações
select2 initialization overwrites selected option in Chrome

Reproducing the issue

  1. Select an option in the select2 element.
  2. Navigate to any other page (www.google.com)
  3. Navigate backwards using the browser back button
  4. Notice the option is "selected" but the shown option is not the "selected" option, but instead the option the select2 element is initialized with.

This can be seen on the Basic Usage page from Select2, which is where this gif is sourced from. enter image description here

Attempted Solutions

I know of a "fix" but it requires me to place every select2 call within a window.onpageshow listener.

This solution is heavy handed and doesn't address the actual issue with the placeholder/initialized options replacing the selected option on page load.

Conclusion

I'm looking for a more conclusive answer to this problem, targeting it at the source. Can anyone help me in identifying what css/js to override to remedy this placeholder replacement of the selected option on page load?

Thanks for reading.

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