0

Help second page checkbox value get. i cant get value checkbox.jsfiidle link is here . help guys :)

$(document).ready(function () {
    var table = $('#example').DataTable({});

    // Handle click on "Select all" control
    $('#example-select-all').on('click', function () {
        // Check/uncheck all checkboxes in the table
        var rows = table.rows({ 'search': 'applied' }).nodes();
        $('input[type="checkbox"]', rows).prop('checked', this.checked);
    });
});

$("#gg").click(function () {
    $("input:checkbox[class=chk]:checked").each(function () {
        alert($(this).val());
    });
});

Visit : https://jsfiddle.net/07Lrpqm7/4089/

byshock
  • 3
  • 3
  • 1
    What is the problem? I went to the second page and clicked a couple checkboxes and clicked the button, it displayed the values in an alert. – Ryan Wilson Jun 25 '18 at 19:12
  • select all checkbox and click button first page . Cant get value second page checkbox – byshock Jun 25 '18 at 19:20
  • 1
    That's because the 2nd page checkboxes are no longer rendered on the screen. You will need to store them in an array variable to keep track of non-visible pages which have had checkboxes checked. – Ryan Wilson Jun 25 '18 at 19:33
  • This may also be a possible duplicate of (https://stackoverflow.com/questions/36217098/checkboxes-only-work-on-first-page-datatables-rails) – Ryan Wilson Jun 25 '18 at 20:00

0 Answers0