This article describes how to create a dynamic Dom Based on JavaScript. For more information, see
Dynamic script
We can use the script element on the page to insert javascript code into the page. There are two ways: one is to reference external JS files through the src attribute, and the other is to use this element to contain a piece of js Code. The so-called dynamic script means that the script does not exist when the page is loaded. In the future, you can modify the DOM to dynamically Add the script. Like html elements, dynamic scripts can be created in two ways: inserting external files and directly inserting JavaScript code.
The dynamically loaded external JavaScript code can be executed immediately, for example, the following code:
var script = document.createElement("script");script.type = "text/javascript";script.src = "demo.js?1.1.11";document.body.appendChild(script);
The above code is displayed inElement generates a script node: