+ 8
Why doesn't this work?
12 Answers
+ 5
var result;
var color;
window.addEventListener('load', init);
function init(){
color = document.getElementById("color");
result = document.getElementById("hexValueResult");
}
function findHexValue() {
result.value = color.value;
}
function copyResult() {
result.select();
document.execCommand("Copy");
}
+ 7
It did! Thanks!
+ 5
Doesn't work still for some reason...
+ 4
You have to set the value attribute of result.
+ 4
window.addEventListener('load', init);
function init(){
var color = document.getElementById("color");
var result = document.getElementById("hexValueResult");
}
function findHexValue() {
result.value = color.value;
}
function copyResult() {
result.select();
document.execCommand("Copy");
}
+ 3
Yep it works, good job
+ 2
Minerals2016 Thank you!
+ 2
Coding Agent you're welcome :)
+ 2
Thanks
0
Check it very well before you use. Or always look out for bugs in your code