I have following code
var $radio1 = $('#FOO1');
var $radio2 = $('#FOO2');
var $radio3 = $('#FOO3');
Now I would like to to sth like
var $radios = $($radio1, $radio2, $radio3);
var $selectedRadio = $radios.filter(':checked');
I know that this won’t work, but could anyone give me a hand with this?
To clarify:
- I do not want to use
jQuery.eachor any alikes as I would like to use selectors (if possible)… - I do not want to use
groups, as I would like to use this with several groups, or no groups, … - I do not want to use
id-selectorsfor the array (eg.$('#FOO1, #FOO2, #FOO3');), as I would like a more generic solution
You can combine it in several ways:
or