I wanna check radio buttons automatically: I tried this code but it does not work: Radio buttons have 3 different values, I wanna select the radio button with value \'clean\
Give your radio buttons "names" would make things a lot easier
var elements = document.getElementsByName('myradios');
for (i=0;i
Working example : http://jsfiddle.net/Dwzc9/
Updated
getElementsByName
doesn't seem to be supported in all IE versions ... so you could use the following based on your original example :
var allElems = document.getElementsByTagName('input');
for (i = 0; i < allElems.length; i++) {
if (allElems[i].type == 'radio' && allElems[i].value == 'clean') {
allElems[i].checked = true;
}
}
Working example : http://jsfiddle.net/Dwzc9/2/