Javascript examples for DOM HTML Element:Input Button
Looping through radio button group
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function loop() {//from w ww . j a v a 2 s . c o m var radios = document.getElementsByName("my"); for (i = 0; i < radios.length; i++) { console.log('looping radio ' + i); } }; </script> </head> <body> <input type="radio" name="my"> radio1 <input type="radio" name="my"> radio2 <input type="button" value="Loop" onclick="loop()"> </body> </html>