Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught Typeerror: cannot read property 'innerHTML' of null

Can anyone explain what is theses errors?

Uncaught TypeError: cannot read property 'innerHTML' of null

View on my website This is the line which is causing the error:

var idPost=document.getElementById("status").innerHTML;

Thanks

like image 561
Davix Ponze Avatar asked Jan 25 '12 13:01

Davix Ponze


1 Answers

Are you declaring the <script> tag before the #status element?

If you do, the statement in that tag will be executed first, and now there is no element with the id status.

The best way is to put this script tag right before the </body> tag.

like image 125
Tran Quoc Bao Avatar answered Sep 20 '22 21:09

Tran Quoc Bao