+ 2

JavaScript Program Help (please)

https://code.sololearn.com/WDTlbE05SHXS/#js In line 3, console.log(id) returns 1, and an element with id 1 exists, but document.getElementById(id) is null. Can someone explain how to fix?

11th Mar 2019, 3:33 PM
yinhaodragon7
yinhaodragon7 - avatar
2 Respuestas
+ 2
Put 1 in quotations. var id = "1";
11th Mar 2019, 3:38 PM
Caleb Daix
Caleb Daix - avatar