, another cool thing from @nghuuphuoc!

Playing with Chosen


Improve it on Github

Use with the Chosen plugin.

The Favorite color option requires to choose 2-4 colors you like most.

<!-- Include chosen CSS, JS -->
<link rel="stylesheet" href="//" />
<script src="//"></script>

<style type="text/css">
#chosenForm .chosen-choices {
    border: 1px solid #ccc;
    border-radius: 4px;
    min-height: 34px;
    padding: 6px 12px;
#chosenForm .form-control-feedback {
    /* To make the feedback icon visible */
    z-index: 100;

<form id="chosenForm" method="post" class="form-horizontal">
    <div class="form-group">
        <label class="col-sm-3 control-label">Favorite color</label>
        <div class="col-sm-5">
            <select class="form-control chosen-select" name="colors" multiple data-placeholder="Choose 2-4 colors">
                <option value="black">Black</option>
                <option value="blue">Blue</option>
                <option value="green">Green</option>
                <option value="orange">Orange</option>
                <option value="red">Red</option>
                <option value="yellow">Yellow</option>
                <option value="white">White</option>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-3">
            <button type="submit" class="btn btn-default">Validate</button>
$(document).ready(function() {
            // Revalidate the color when it is changed
            .change(function(e) {
                $('#chosenForm').bootstrapValidator('revalidateField', 'colors');
            excluded: ':disabled',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            fields: {
                colors: {
                    validators: {
                        callback: {
                            message: 'Please choose 2-4 color you like most',
                            callback: function(value, validator) {
                                // Get the selected options
                                var options = validator.getFieldElements('colors').val();
                                return (options != null && options.length >= 2 && options.length <= 4);