Export (0) Print
Expand All
1 out of 4 rated this helpful - Rate this topic

innerText property

Sets or retrieves the text between the start and end tags of the object.

Syntax

HRESULT value = object.put_innerText( text);HRESULT value = object.get_innerText(* text);

Property values

Type: BSTR

the text between the start and end tags.

Remarks

The IHTMLElement::innerText property is valid for block elements only. By definition, elements that do not have both an opening and closing tag cannot have an IHTMLElement::innerText property.

The IHTMLElement::innerText property is read-only on the html, table, tBody, tFoot, tHead, and tr objects.

When the IHTMLElement::innerText property is set, the given string completely replaces the existing content of the object.

You can set this property only after the HTMLFrameSiteEvents::onload event fires on the window. When dynamically creating a tag using TextRange, IHTMLElement::innerHTML, or IHTMLElement::outerHTML, use Microsoft JScript to create new events to handle the newly formed tags. Microsoft Visual Basic Scripting Edition (VBScript) is not supported.

You can change the value of the title element using the document.title property.

To change the contents of the table, tFoot, tHead, and tr elements, use the table object model. For example, use the IHTMLTableRow::rowIndex property or the rows collection to retrieve a reference to a specific table row. To retrieve a reference to a specific cell, use the IHTMLTableCell::cellIndex property or the cells collection. You can add or delete rows using the IHTMLTableRow::insertCell and IHTMLTableRow::deleteCell methods. To change the content of a particular cell, use the IHTMLElement::innerHTML property.

Security Warning:   The IHTMLElement::innerText property can be used to safely add dynamic text to a webpage if the target element type is not a script element. With the exception of the script element, IHTMLElement::innerText does not execute script when inserting text into the Document Object Model (DOM) of a webpage.

See also

IHTMLElement::insertAdjacentText

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.