Friday, 5 August 2016

javascript - getElementById() returns null even though the element exists




I'm trying to get the element with getElementById(), but it returns null even though the element exists. What am I doing wrong?






blah











Answer



You have to put this in a document load event. The DOM hasn't gotten to abc by the time the script is executed.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...