Here I have two tables, and in each table I have checked boxes. I am getting the checked values from both, but I am saving in two different arrays and combining to into a single one.
Is there any way to get the checked checkbox values from both tables, but only from these tables?
var First = [];
var Second = [];
First = $("#table1 input:checkbox:checked").map(function () {
First[i] = $(this).val();
return $(this).val();
}).get();
Second = $("#table2 input:checkbox:checked").map(function () {
Second[i] = $(this).val();
return $(this).val();
}).get();
var subjes = First + Second;
Just use a selector that selects checkboxes in both tables before you map them :
var boxes = $('input:checkbox:checked', '#MainContent_CBLFYSubjects, #MainContent_CBLSYSubjects'),
subjes = $.map(boxes, function(el){
return el.value;
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments