Javascript examples for DOM HTML Element:Input Hidden
Input Hidden name Property - Change the name of a hidden input field:
<!DOCTYPE html> <html> <body> A hidden input field: <input type="hidden" id="myInput" name="country" value="Norway"> <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myInput").name; console.log("The name of the hidden input field is: " + x); } function change() {//from w w w .ja va 2 s . c om var x = document.getElementById("myInput").name = "newName"; console.log("The name was changed to: " + x); } </script> </body> </html>