Alex Rivera | Logout

Unselect group of radio buttons using jQuery

Asked 2011-08-12T17:56:41.880
12

I'm using jQuery and I have a group of radio buttons all with the same name, but different value properties.

For example:

<input type = "radio" name = "thename" value="1"></input>
<input type = "radio" name = "thename" value="2"></input>
<input type = "radio" name = "thename" value="3"></input>

I want to make it so they are all unselected. Current state of my page has one of them clicked. How do I do this?

Edit
Report

2 Answers

11
$("input:radio[name='thename']").each(function(i) {
       this.checked = false;
});

not sure why the jquery prop doesn't work and this does...

answered 2012-09-05T17:08:53.633
1

Try the following code:

$(input[name=thename]).removeAttr('checked');
answered 2011-08-12T18:00:03.173

Your Answer