How can I change the value in the input?
-
Hello, there is a code:
<form> <input type="color" value="" id="favcolor"> </form> <input id="hex"> <script> var theInput = document.getElementById("favcolor"); var theColor = theInput.value; theInput.addEventListener("input", function() { document.getElementById("hex").innerHTML = theInput.value; }); </script>
After choosing a color, the color code is added in the console (ctrl + shift + c in chrome), but in fact this is not visible, please tell meJavaScript Anonymous, Dec 4, 2019 -
not
innerHTML
document.getElementById("hex").innerHTML = theInput.value;
avalue
document.getElementById("hex").value = theInput.value;
since thereinput
Anonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!