Reputation: 73
I have multiple form with unique id and has same set of checkbox elements. I want to get the list of checkbox ids in an array using jQuery and send it to mvc action where the argument is of type IEnumberable.
I used the below code in jQuery to get the checked checkbox inside the form but not successful. Can anyone help me how to solve this?
var test = $("#11form input[type='checkbox']:checked");
alert(test.length);
Thanks in advance
Upvotes: 0
Views: 1038
Reputation: 87073
var test = $("#11form input[type='checkbox']:checked");
var ids = test.map(function() {
return this.id;
}).toArray();
Upvotes: 1