wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes UnChecking a single radio button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "UnChecking a single radio button" Watch "UnChecking a single radio button" New topic
Author

UnChecking a single radio button

Songezo Nkukwana
Ranch Hand

Joined: Nov 27, 2008
Posts: 51
I have a dynamic list of radio buttons created at run time. This list can be anything from 1 (1 Item and its Radio button). But my javascript seems to only cater for 2 or more radio buttons. My attempt is to uncheck a selected radio button when a clear button next to each radio is clicked.



This only works when the list of Radio buttons is more than 1 (the for loop) ... btngrp is a property of a form bean declared as String radioButtons passed as: onclick = "unCheckRadio(radioButtons ); " ... Is there a better or working way to solve this problem when only a single Radio button is created?
Songezo Nkukwana
Ranch Hand

Joined: Nov 27, 2008
Posts: 51
Songezo Nkukwana wrote:I have a dynamic list of radio buttons created at run time. This list can be anything from 1 (1 Item and its Radio button). But my javascript seems to only cater for 2 or more radio buttons. My attempt is to uncheck a selected radio button when a clear button next to each radio is clicked.



This only works when the list of Radio buttons is more than 1 (the for loop) ... btngrp is a property of a form bean declared as String radioButtons passed as: onclick = "unCheckRadio(radioButtons ); " ... Is there a better or working way to solve this problem when only a single Radio button is created?


oops! btngrp.checked == false; should be btngrp.checked = false; ...
 
jQuery in Action, 2nd edition
 
subject: UnChecking a single radio button
 
Similar Threads
How to dynamically "Check" the radio button based on condition
Problem on getting values from a radio buttons group
radio button using javascript DOM
Simple: Turning A Program Into An Applet
trying to submit a form using hyperlink (href)