Uncaught TypeError: Cannot read property 'appendChild' of null

后端 未结 10 2052
予麋鹿
予麋鹿 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:02

    Use querySelector insted of getElementById();

    var c = document.querySelector('#mainContent');
        c.appendChild(document.createElement('div'));
    

提交回复
热议问题