Is trying to find a way to store input color values into a dictionary:
<input type="color" value="#ff0000" id="colorPicker">
But the current code can't make any input hex values store into the dictionary even with eventlistener added:
var Colors = {
"purple": "FF3CFF",
"input": ""
}
var colorInput = document.getElementById("colorPicker");
colorInput.addEventListener("input", function(){
Colors["input"] = colorInput.value.replace('#','');
}, false);
The idea of the current code is to store the input color's hex values (removed hash symbol) to the Colors dictionary key input every time the input color changes. But now console.log shown no values can be add to "input"...
Update: apparently the color values can only be recorded inside the addEventLister's function(), so are there anyways to make the values go outside it?