Javascript examples for DOM HTML Element:Input Radio
Input Radio name Property - Change the name of a checkbox:
<!DOCTYPE html> <html> <body> <form> <input type="radio" name="colors" value="red" id="myRadio">Red<br> </form>//from w ww . jav a2s .c o m <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myRadio").name; console.log("The name of the radio button is: " + x); } function change() { var x = document.getElementById("myRadio").name = "newRadioName"; console.log("The name was changed to: " + x); } </script> </body> </html>