Javascript examples for DOM HTML Element:Input Color
The type property returns the type of form element.
For a color picker this property always returns "color".
A String, representing the type of form element the color picker is
The following code shows how to check which type of form element the color picker is:
<!DOCTYPE html> <html> <body> A color picker: <input type="color" id="myColor"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w .j av a2s . c o m*/ var x = document.getElementById("myColor").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>