+ 2

this code is not working

I get an error 'getElementById' is not defined Line: 8 in this code var button = getElementById('button'); var count = 0; while (true){ if (button.val === true){ count += 1; } counter.innerHTML = count; } var counter = getElementById('counter');

6th May 2018, 10:11 AM
Matthew Li
Matthew Li - avatar
2 Answers
+ 5
document.getElementById() not:: getElementById
6th May 2018, 10:27 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
"document" is missing!! it should be document. getElementById("button").
6th May 2018, 12:34 PM
🩋FEATHER🩋
🩋FEATHER🩋 - avatar