GitHub 6248★

Insert given HTML before an element

JavaScript version

const insertHtmlBefore = (html, ele) => ele.insertAdjacentHTML('beforebegin', html);

TypeScript version

const insertHtmlBefore = (html: string, ele: Element): void => ele.insertAdjacentHTML('beforebegin', html);
Follow me on and to get more useful contents.