HTML DOM Element insertAdjacentHTML()
HTML DOM Element insertAdjacentHTML() Method
The insertAdjacentHTML() method is used for inserting HTML code into a specified position.
Some positions are:-
Value | Description |
---|---|
afterbegin | After the beginning of the element of the first child. |
afterend | After the element. |
beforebegin | Before the element. |
beforeend | Before the end of the element of the last child. |
Syntax:-
Its syntax is:- element.insertAdjacentHTML(position, html) OR node.insertAdjacentHTML(position, html)
Further Explanation:-
Parameter | Description |
position | Required. Position relative to the element. |
html | The html to insert. |