insertAdjacentText method

Inserts the given text into the element at the specified location.

Syntax

HRESULT retVal = object.insertAdjacentText(where, text);

Parameters

where [in]

Type: BSTR

BSTR that specifies where to insert the text, using one of the following values:

beforeBegin

Inserts the text immediately before the element.

afterBegin

Inserts the text after the start of the element but before all other content in the element.

beforeEnd

Inserts the text immediately before the end of the element but after all other content in the element.

afterEnd

Inserts the text immediately after the end of the element.

text [in]

Type: BSTR

BSTR that specifies the text to insert.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information

There are no standards that apply here.

Remarks

The text inserted into the element is plain text

You cannot insert text while the document loads. Wait for the HTMLFrameSiteEvents::onload event to fire before attempting to call this method.

See also

Reference

IHTMLElement::innerText

IHTMLElement::insertAdjacentHTML

IHTMLElement::outerText