Reputation: 7039
I have a table that i am enumerating through my model with. I have this check box there for each row.
<input type="checkbox" name="IsSelected" value="<%=item.PartNo%>" />
I would like to use jquery to find out which of the check boxes are checked I tried doing this
var selected = $("#IsSelected").val();
but selected is just undefined. is there a way to do this? Thank you
Upvotes: 0
Views: 225
Reputation: 8981
First of all you should change your code to
<input type="checkbox" id="IsSelected" name="IsSelected" value="<%=item.PartNo%>" />
You can use jquery .is(':checked') to determine if checkbox is checked or not.
Upvotes: -1
Reputation: 44919
var checkedCheckboxes = $("input[name='IsSelected']:checked");
checkedCheckboxes
should then be a collection of the checked checkboxes
Upvotes: 2