Reputation: 46222
I have a bunch of checkboxes tha start with CheckRR_
I like to loop only for ones that starts with "CheckRR_" and are checked. How would I do this?
I have the following so far:
$('input[name^="CheckRRR_"]').filter(":visible").each(function () { ....
This works for only the ones that are visible, not checked. I like to look for ones that are checked.
Upvotes: 0
Views: 175
Reputation: 106385
Try filter(":checked")
instead. Or just
$('input[name^="CheckRRR_"] :checked').each(...)
Upvotes: 2
Reputation: 150253
You can do it with one selector:
$('input[name^="CheckRRR_"]:visible:checked').each(function () {...
If you don't care if they are visible or not:
$('input[name^="CheckRRR_"]:checked').each(function () {...
:checked
docs
Upvotes: 0
Reputation: 2858
Did you try this yet?
$('input[name^="CheckRRR_"]:checked').each(function () {
Upvotes: 1