Checkboxes will only work on current pagination page in jQuery datatables

后端 未结 2 1047
半阙折子戏
半阙折子戏 2021-01-16 00:34

I am using jquery data table for listing my content which have checkbox selection and selected content post the data but in submitted form only current page data sent.

2条回答
  •  無奈伤痛
    2021-01-16 01:10

    You can check them at the end.

    var table = $("#yourtablename").DataTable({
        //your datatable options(optional)
    });
    

    Now jQuery have access to all the rows by following code

      table.$('td > input:checkbox').each(function () {
                // If checkbox is checked
                if (this.checked) {
                 //Your code for example
                    alert($(this).attr('name'));
                }
        }); 
    

提交回复
热议问题