Ga naar inhoud

Blog

Bootstrap 4 - Chosen Validation

Install the Chosen component from Bootstrap4C.

Add the class .form-control-chosen to your select, and add the following validation to your javascript:

$('form').on('submit', function(){ $('.form-control-chosen[required]').each(function(){ if ( $( this ).val() == '' ) $( this ).next().removeClass('is-valid').addClass('is-invalid'); else $( this ).next().removeClass('is-invalid').addClass('is-valid'); }); });

Thanks to richardwo!

Urls
Zoeken
Een moment geduld a.u.b....