0
What's wrong with this code
2 Antworten
+ 2
Prasad Dharani
You put quotes around the c1 and c2. You do not need to do that because they are variables that were assigned the ids when the ids were passed to the function processData('color1','color2')
("c1") should be (c1)
("c2") should be (c2)
https://code.sololearn.com/WXcd4HTUfFfM/#js
+ 2
Your color inputs have the id's "color1" and "color2" so change your Javascript file to:
function processData(c1, c2) {
var cv1 = document.getElementById("color1").value;
var cv2 = document.getElementById("color2").value;
alert(cv1+"\n"+cv2);
}
In the document.getElementById functions "c1" has been changed to "color1" and "c2" has been changed to "color2"