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
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply 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: 788
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: 56230
    
  13

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


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 788
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: 56230
    
  13

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
 
Similar Threads
radio buttons selection
selecting a check box from a list of check boxes
radio buttons-storing different values
Radio Buttons
jQuery validation and radio buttons