| Viewed 21 times

Using jquery how to get all selected checkboxes in an array


I have a checkbox with name="v", so how I can do it

1 Answer
Mohammad Qandeel
Answered
0

you can use this snippet 

<script>
 var mySelectedArray= new Array(); // initialize array
    $("input:checkbox[name=v]:checked").each(function(){ 
        mySelectedArray.push($(this).val()); //add the checkbox value into array
    });
</script>