Javascript examples for DOM HTML Element:Input Number
Input Number name Property - Change the name of a number field:
<!DOCTYPE html> <html> <body> <input type="number" id="myNumber" name="quantity"> <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myNumber").name; console.log("The name of the number field is: " + x); } function change() {//from www. j a v a 2 s .c om var x = document.getElementById("myNumber").name = "newNumberName"; console.log("The name was changed to: " + x); } </script> </body> </html>