fSelect Clear Selection

后端 未结 2 849
日久生厌
日久生厌 2021-01-03 13:38

How to clear fSelect multi-select drop-down in click event, Here is an example By Clicking on Clear button It should remove all Selected value.

2条回答
  •  清歌不尽
    2021-01-03 14:26

    For future references: Using a fork of fSelect which has a better reload function, doing the following can reset the values and the selected items:

    (function($) {
        $(function() {
            $('.my-select-box').fSelect();
            $('#ClearSelect').click(function(){
                $("#fselectMulti option").prop("selected", false);
                $('.my-select-box').fSelect('reload');
            })
        });
    
    })(jQuery);
    

提交回复
热议问题