New course! Every coder should learn Generative AI!
Try a free lesson+ 13
How can I check if set is pressed with <input> type="color" </input>?
Short answer would be appreciated
1 Answer
+ 10
<input type="color" id="cl" onchange="getColor(this.value);">
<script>
function getColor(c){
alert(c);
}
</script>
You could also get it like the following, but you've got to invoke something to get it:
var c = document.getElementById("cl").value;