Jquery Tutorial: Select or deselect a radio button

Today was the first time I tried to do this and believe it or not many of the tutorials/examples I found on good ole Google didn’t work. So after about 45 minutes I finally found an example that worked for me. Hopefully you won’t spend as long looking for the answer as I did.

//select the radio button
$("input[name=your_field_name_here][value='the_value_of_that_field_here']").attr("checked","checked");

//deselect the radio button
$("input[name=your_field_name_here][value='the_value_of_that_field_here']").attr("checked","");

Reference:  Comment posted by JoaoLuiz at the bottom

You may also like...

Leave a Reply