Javascript examples for DOM HTML Element:Input Color
Input Color name Property - Change the name of a color picker:
<!DOCTYPE html> <html> <body> A color picker: <input type="color" id="myColor" name="favcolor"> <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myColor").name; console.log("The name of the color picker is: " + x); } function change() {//from w w w . j ava 2s . c om var x = document.getElementById("myColor").name = "newColorName"; console.log("The name was changed to: " + x); } </script> </body> </html>