Bootstrap Switch, global checkbox to (un)check all other

后端 未结 3 910
走了就别回头了
走了就别回头了 2021-01-12 00:18

I am using Bootstrap Switch for Twitter Bootstrap. Here I have problem to check or uncheck all checkbox based on global checkbox checked or unchecked

Here is the boo

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-12 00:34

    Try this one, it should work. Also see this jsfiddle...http://jsfiddle.net/URAcy/5/

      
    

    JS:

    $('#rowSelectAll').on('switch-change', function (e, data) {
        var $el = $(data.el)
          , value = data.value;
            $('.toggle-state-switch').each(function( index ) {
          $(this).bootstrapSwitch('setState' , value);
        });
    });
    

提交回复
热议问题