Any idea why the piece of code below does not add the script element to the DOM?
var code = \"\";
$(\"#someElement\").append(cod
-
I wrote an npm
package that lets you take an HTML string, including script tags and append it to a container while executing the scripts
Example:
import appendHtml from 'appendhtml';
const html = 'Hello
';
const container = document.getElementById('some-div');
await appendHtml(html, container);
// appendHtml returns a Promise, some_js_file.js is now loaded and executed (note the await)
Find it here: https://www.npmjs.com/package/appendhtml
- 热议问题