javascript - There are js imports in the innerHTML content or the statements cannot run properly.
習慣沉默2017-06-30 09:58:51
0
2
922
When using innerHTML to add content on the
node, we found that if there is a <script> tag in the innerHTML string, the js statement in the tag cannot be run and the src attribute is invalid (external js files cannot be imported). How to solve this problem?
innerHTML can insert link tags, but cannot insert script tags; the insertion of script tags can be completed through appendChild of js.
The nested HTML document in the body is not written in a standardized way