How can I select all checkboxes from all the pages in a jQuery DataTable

前端 未结 6 2058
既然无缘
既然无缘 2020-11-29 05:11

I have HTML page which have multiple checkboxes and individually they can be checked. I have button for \"Select All\" and when I click on this button all the check

6条回答
  •  自闭症患者
    2020-11-29 06:11

    DEMO

    Easiest way is to use following jQuery code:

    //EDIT on the second click, you now remove all checked boxes.

    $('#selectAll').click(function(e) {
        if($(this).hasClass('checkedAll')) {
          $('input').prop('checked', false);   
          $(this).removeClass('checkedAll');
        } else {
          $('input').prop('checked', true);
          $(this).addClass('checkedAll');
        }
    });
    
    
            
            
            monitoring
            
             																			
            
    Name Company Employee Type Address Country
    varun TCS IT San Francisco US
    Rahuk TCS IT San Francisco US
    johm Doe TCS IT San Francisco US
    Sam TCS IT San Francisco US
    Lara TCS IT San Francisco US
    Jay TCS IT San Francisco US
    Tom TCS IT San Francisco US

提交回复
热议问题