What's wrong with this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
17th Feb 2019, 6:46 AM
Prasad Dharani
Prasad Dharani - avatar
2 Answers
+ 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
17th Feb 2019, 8:17 AM
ODLNT
ODLNT - avatar
+ 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"
17th Feb 2019, 7:06 AM
LynTon
LynTon - avatar