we need to identify the position where we want to display the content.For that we need to specify the specific div or any HTML element with a unique class name that will serve as the target for the content. Later we need to update the target in the Script.
const script = document.createElement(“script”);
script.setAttribute(“type”, “text/javascript”);
script.src = “https://js.hsforms.net/forms/embed/v2.js”;
script.addEventListener(“load”, () => {
hbspt.forms.create({
region: “na1”,
portalId: “23130323”,
formId: “22b95edc-a15c-4996-af4c-d32d6650a3a5”,
target: “#myForumContainer”,
});
});
document.head.prepend(script);