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
2010-01-31 21:57:01
Thanks I used it as such: jQuery.each(cookieObj, function(i, val) { $(":radio[value=val]").attr('checked',true); });
nav
2010-01-31 22:04:40
@test: Try this instead: `function(i, val) { $(":radio[value="+val+"]").attr('checked',true); }`
Gumbo
2010-01-31 22:14:43