Generally, it is because the obtained node does not exist
The reasons may be as follows:
When you get this node, it is not loaded. For example, write JS code in & lt; head> Inside, you get the node of the body, which you can’t get at this time. Put JS code in & lt; body> You can get it later
Similar Posts:
- Cannot read property ‘appendChild’ of null
- How to Solve Error: Cannot set property ‘onclick’ of null
- [How to Solve] Cannot set property ‘onclick’ of null
- Document.body.clientheight cannot get the browser page height correctly
- document.body.scrollTop or document.documentElement.scrollTop
- JavaScript Uncaught TypeError: Cannot set property ‘innerHTML’ of null”
- Always report uncaught error:[$ injector:modulerr ]Solutions to errors
- ”Cannot read property ‘addEventListener’ of null“
- [Solved] syntax error, expect {, actual error, pos 0, fastjson-version 1.2.57
- Name Error: name ‘yolo_head’ is not defined [How to Solve]