How to access radioButton individual items?
Posted
by vikitor
on Stack Overflow
See other posts from Stack Overflow
or by vikitor
Published on 2010-03-23T16:03:27Z
Indexed on
2010/03/23
16:33 UTC
Read the original article
Hit count: 194
JavaScript
Hello, I've got 2 radio button groups showed differently depending on the value selected on another radio button. The thing is that I would like to set the default value of the group to the first element in the radiobutton group, but when I change from the other radio button it preserves the value previously selected, when I want it to be reset to the default value.
I've been searching in the javascript repository but apparently I cannot access like it says with radio[1].checked = true
... It says that radio[1]
is undefined, but radio is an HTML Input element object. I'm accessing it from a different file, but var radio = document.getElementById("radio")
works, but I can't access the individual radiobuttons.
Thank you in advance
© Stack Overflow or respective owner