views:

1010

answers:

1

How would I use JQuery to find a radio button by its value?

+7  A: 

Try this:

$(":radio[value=foobar]")

This will select all radio buttons with the attribute value="foobar".

Gumbo
Thanks I used it as such: jQuery.each(cookieObj, function(i, val) { $(":radio[value=val]").attr('checked',true); });
nav
@test: Try this instead: `function(i, val) { $(":radio[value="+val+"]").attr('checked',true); }`
Gumbo