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

201
Vistas
validating bootstrap 5 form dropdown with chosen plug-in

I use Bootstrap 5 with the plugin Chosen to add a search functionnality on long dropdowns. I used a css theme for Chosen that was designed to imitate Bootstrap 4 but the result is fine.

The issue is that form validation styles are not applied to the chosen select.

I've artificially managed to apply style to the chosen element depending on the main select validating state when the form is submitted :

function validate_chosen(element) {

var select = $('#'+element.id + '_chosen .chosen-single');
if (element.checkValidity()) {              
    select.addClass('is-valid');  
    select.removeClass('is-invalid');
}
else {
    select.addClass('is-invalid');  
    select.removeClass('is-valid');
 }
}

but that solution looks gross and i've still an issue with the style not updating when the value is changed. I've tried to add "click" event to the chosen list but it seems that the chosen JS takes upper hand on my events.

Could you help me to sort this out ? I wouldn't mind switching to another plugin if it had similar functionalities but better integration with the bootstrap look and feel.

Thank you

about 4 years ago · Santiago Gelvez
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