Input Color value Property - Get the color of a color picker: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Color

Description

Input Color value Property - Get the color of a color picker:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

A color picker: <input type="color" id="myColor" value="#ff0080">

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//  w  w  w.  jav  a  2  s  . c  o m
    var x = document.getElementById("myColor").value;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials