Two Laptop Bag
The moose likes HTML, CSS and JavaScript and the fly likes setting a radio button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "setting a radio button" Watch "setting a radio button" New topic

setting a radio button

Joseph Miller

Joined: Jun 19, 2001
Posts: 21
anyone know how to set a radio button checked with javascript? I'm confused because they have the same name...
<input type=radio name='exampleRadio' value='1'>
<input type=radio name='exampleRadio' value='2'>
so if I want to set the value 2 radio button to checked based on some other user action how do I do it? this.formName.exampleRadio.checked...
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Here is a brief example:

Note change "on-Click" to "onClick", had to post the code like this
I agree. Here's the link:
subject: setting a radio button
It's not a secret anymore!