check box all in jequery data table

Solutions on MaxInterview for check box all in jequery data table by the best coders in the world

showing results for - "check box all in jequery data table"
Elisa
14 Mar 2019
1$(document).ready(function () { 
2    var oTable = $('#example').dataTable({
3        stateSave: true
4    });
5
6    var allPages = oTable.fnGetNodes();
7
8    $('body').on('click', '#selectAll', function () {
9        if ($(this).hasClass('allChecked')) {
10            $('input[type="checkbox"]', allPages).prop('checked', false);
11        } else {
12            $('input[type="checkbox"]', allPages).prop('checked', true);
13        }
14        $(this).toggleClass('allChecked');
15    })
16});
17