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

200
Visualizações
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 à 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