Reputation: 68790
In my code I have the following which gets a collection of the Country radio controls:
model.countries = $('input:radio[name="Country)"]');
Later in the code I need to know the val() of the "checked" radio. How do I get to it?
I've tried:
model.countries.is(':checked')
but that of course just finds if any is checked. I need the val() of the checked radio.
Upvotes: 0
Views: 49
Reputation: 7328
You can use .filter(selector)
to filter your current selection, then call .val()
to retrieve the value of the desired element:
model.countries.filter(':checked').val()
Upvotes: 6