I am using jquery datatables. There I use a check box for each row inside the table. Now that I want the user to click all the links located outside the table, select all the records in the table. For this, I use this function.
function checkAll(formname, checktoggle) { var checkboxes = new Array(); checkboxes = document[formname].getElementsByTagName('input'); for (var i=0; i<checkboxes.length; i++) { if (checkboxes[i].type == 'checkbox') { checkboxes[i].checked = checktoggle; } } }
Select all links here.
<a onclick="javascript:checkAll('frm_charges', true);" href="javascript:void(0);">Select All</a>
"frm_charges" is the name and identifier of the form.
This is the code for the checkbox that I use inside the table.
<input type="checkbox" value="742" name="charges[]" class="charges" style="opacity: 0; position: absolute; z-index: -1; visibility: hidden;">
Now my problem is that I have pagination, it is the selection of lines from the first page, but not on all pages. 
source share