aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery - deselect same name radio buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery - deselect same name radio buttons" Watch "jQuery - deselect same name radio buttons" New topic
Author

jQuery - deselect same name radio buttons

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 823
I have 3 radio buttons on a page, after selecting one, an action is performed, and the 3 radio buttons get hidden until a user clicks a button to redisplay them. When they re-appear I want to have the radio buttons to be all unchecked as they initially were (all = with the same name, i.e. leaving all other radio buttons alone on the page). What's the easiest way to accomplish this in jQuery? Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Remove the checked attribute from all of them. (Or try setting the checked attribute to Boolean false with the attr() method.)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 823
Thanks for the reply Bear. I was wondering more along the lines of how to select all radio buttons with a particular name then I was going to use removeAttr("selected") on the results. $('input <what else is needed>').removeAtr('selected'). Thanks again.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

selected is for <options> not radio buttons. Use checked.


To select:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jQuery - deselect same name radio buttons