Uncaught TypeError: Cannot read property 'appendChild' of null

后端 未结 10 2058
予麋鹿
予麋鹿 2020-12-14 08:43

I\'m getting the following error

Uncaught TypeError: Cannot read property \'appendChild\' of null

myRequest.onreadystatechange @ script.js

10条回答
  •  醉酒成梦
    2020-12-14 09:14

    those getting querySelector or getElementById that returns the following error:

    Uncaught TypeError: Cannot read property 'appendChild' of null
    

    or any other property, even if you have a class name or id in the HTML

    don't use (defer as it is too much browser dependent.)

      //don't use this
    

    instead, put all your code in 'script.js' inside

    $(document).ready(function(){
        //your script here.
    }
    

提交回复
热议问题