I have an input type=checkbox
that contains id
from 1-10
. I need to select some check boxes and when I click on a particular click event I need to store all checkboxes values (1-0/ checked-not checked)
and id
s in 2d array and send to php page using ajax.
<input type="checkbox" id='1' name="ppackages" class="success">
var popularpackages = [];
$("input:checkbox").each(function(){
var $this = $(this);
popularpackages.push($this.attr("id"));
});
alert(popularpackages);
The output is 1,2,3,4,5,6,7,8,9,10
But I need as (id,checked/not checked)
(1,1),(2,0),.....(10,0)