Reputation: 1027
Could someone please help me to understand how can i get all the checkbox were checked throughout all the pagination page?
using below seem only show the current page checkbox, not all pages.
Not sure if anything miss out, thanks for enlightenment!
$('input[name=myCheckbox]:checked');
Thanks in advance for your help!
Upvotes: 1
Views: 2550
Reputation: 4259
This might be what you are looking for
<input type="checkbox" onchange="selectCheckbox(this)" />
var selectedUnits = [];
function selectCheckbox(data) {
if (selectedUnits.length < 1) {
selectedUnits.push(data.value);
}
else {
if (data.checked == true) {
if ($.inArray(data.value, selectedUnits) < 0) {
selectedUnits.push(data.value);
}
else {
selectedUnits.pop(data.value);
}
}
else {
selectedUnits.pop(data.value);
}
}
}
Upvotes: 1