Menu
Hello,
I am using getElementsByTagName(‘input’) and would like to return the id of the radio button that is checked. My script returns: ‘undefined’. 😮 I was hoping to see the string that I had set for the id property in my HTML.
Here is what I tried:
function Test()
{
var docButtons=document.getElementsByTagName(‘input’)
for (var i=0; i<docButtons.length; i++)
{ if (docButtons[i].checked == true) {alert(docButtons.id)} }
}
I was leery on ‘docButtons.id’ but figured I would give it a shot. Will someone please help me out?
Thanks ?