. Advertisement .
..3..
. Advertisement .
..4..
Today I get the ”uncaught typeerror: cannot read property ‘value’ of null” error when I command this line:
var inputVal = document.getElementById("input").value;
Then I receive the error message:
TypeError: Cannot read property 'value' of null
Can someone tell me how to fix this issue?
The cause: The element with the id input not existing will be the cause. Let me explain it in simpler terms:
Solution: You can fix this issue by making sure that
btn
, or any object you use, is not null before you use it. For example: