Search code examples
jqueryicheckbootstrap-multiselect

How to make bootstrap multi-select plugin working with icheck plugin


I've used this bootstrap multiselect and this checkbox/radio plugin at my webpage. Suddenly, I noticed that when icheck put inside multiselect, no default and customized functions of multiselect working! This is my work without icheck plugin: Fiddle And this is the Fiddle with icheck where functions of multiselect are not working. The functionality which I need working with icheck too:

$('#data-type').multiselect({
    includeSelectAllOption: true,
    buttonWidth: '90%',
    nonSelectedText: 'Select multiple option',
    onChange: function(element, checked) {
        var selectedOptions = $('#data-type option:selected');

        if (selectedOptions.length == 0) {
           // Custom code
           alert('All are unchecked!');
        }
    }

});

$('input').iCheck({
    checkboxClass: 'checkbox-default',
    radioClass: 'radio-default',
});

How can I make multiselect work again with icheck plugin too?


Solution

  • It's a bug in iCheck https://github.com/fronteed/iCheck/issues/68. The bug was fixed in version 2. Also iCheck was replaced with icheck. It's your example http://jsfiddle.net/koa58o4o/1/.

    $('input').icheck({
        checkboxClass: 'checkbox-default',
        radioClass: 'radio-default',
    });
    

    With working "Select All" http://jsfiddle.net/koa58o4o/4/