HTML DOM Element insertAdjacentElement()
HTML DOM Element insertAdjacentElement() Method
The insertAdjacentElement() method is used for inserting an element 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.insertAdjacentElement(position, element) OR node.insertAdjacentElement(position, element)
Further Explanation:-
Parameter | Description |
position | Required. Position relative to the element. |
element | The element to insert. |