Parses text as an HTML fragment and inserts it into the DOM at the specified location.
Parses text as an HTML fragment and inserts it into the DOM at the specified location.
The where parameter indicates where to insert the HTML fragment:
'afterEnd': Immediately after this element.
var html = '<div class="something">content</div>'; // Inserts as the first child document.body.insertAdjacentHtml('afterBegin', html); var createdElement = document.body.children0; print(createdElement.classes0); // Prints 'something'
See also: