i working on website several forms of radio buttons, 1 of this:
<form id = "configuration"> <ul> <li><input type="radio" name="configuration" id="0" value="0"/> gt manual</li> <li><input type="radio" name="configuration" id="1" value="1"/> gt automatic</li> </ul> </form>
is there way (javascript) can access value of radio buttons directly, e.g.
var value = document.getelementbyid("configuration").configuration.value;
(here first "configuration" form id while second 'configuration' name, rather looping through each element in form check button selected?
thank you!
get this...
var radios = document.getelementsbyname('configuration'); (i = 0; < radios.length; i++) { if (radios[i].type == 'radio' && radios[i].checked) { alert(radios[i].value); } }
Comments
Post a Comment