Element.insertAdjacentHTML() (Method)

Insert some HTML into the document adjacent to this element.

Availability:

JScript - 3.0
Internet Explorer - 4.0
Property/method value type:undefined
JavaScript syntax:IEmyElement.insertAdjacentHTML(aRelativePosition, someHTML)
Argument list:aRelativePositionAn indication of where the new HTML is to be placed
someHTMLThe new fragment of HTML to be inserted

This is quite similar to an expression that assigns a new value to the innerHTML property of an Element object. In this case, the new HTML leaves the existing HTML intact.

The relative positions where the adjacent HTML can be introduced determine where the new HTML is to be inserted. The following relative positions can be specified:

Position:Description:
AfterBeginImmediately after the opening tag and before any other content
AfterEndImmediately after the closing tag and before any other content
BeforeBeginImmediately before the opening tag
BeforeEndImmediately before the closing tag

Warnings:

See also:Element object, Element.getAdjacentText(), Element.innerHTML, Element.innerText, Element.insertAdjacentText(), Element.outerHTML, Element.outerText

insert figure 0047