0

JS help needed. Can not read value of null

I have created this small program that tells you if the entered value is an even number or not. I have noticed that there is an error that shows that it can not read a value of null. How can i fix it? The program works fine but i would still like to know how to fix the error and why it happend. Thx for the help. https://code.sololearn.com/W5Bn2CWR2dbE/?ref=app

17th Dec 2018, 5:37 AM
Webnell
Webnell - avatar
1 Answer
0
Quick solution : comment or remove your line 16. Explanation : You are trying to find the DOM before it exists. See following demo for details: https://code.sololearn.com/WriFNOoR188j/?ref=app
17th Dec 2018, 5:39 AM
Gordon
Gordon - avatar