Adding Custom HTML Codes
Last updated
Was this helpful?
Was this helpful?
// create the script tag
let scriptTag = document.createElement("script");
// set the attributes for the script tag
scriptTag.setAttribute("type", "text/javascript");
scriptTag.setAttribute("data-key", "1");
scriptTag.setAttribute("src", "https://cdn.example.com/deliver/some.js");
scriptTag.async = true;
// Append the script tag to the head
document.head.appendChild(scriptTag);