Element.outerText (Property)

The outer text of a tag in the document.


JScript - 3.0
Internet Explorer - 4.0
Property/method value type:String primitive
JavaScript syntax:IEmyElement.outerText
IEmyElement.outerText = aString
Argument list:aStringSome new text content to place outside the object

The HTML from the start tag to the end tag, including the tags that define the element, is extracted and any tags are removed. The resulting text is returned when this property is being read.

You can read this value to extract a fragment of text, and you can write to this value to redefine a section of text within the page.

When the property is being written to, the start and end tags are destroyed because everything between them and the tags is replaced with a text string. To place new HTML tags as replacements, for the ones you are about to destroy, use the outerHTML property.

DOM standardization provides access to the content of a Text and CharacterData object. These are special cases of the Node object which is also the parent of the Element object. We really need the Element object to inherit the data accessors of the CharacterData object as well and for now at least it doesn't. So long as you want to access text in between Element objects, you may be able to navigate the Node hierarchy and access properties of the Text objects between each Element.


See also:Element object, Element.innerHTML, Element.innerText, Element.insertAdjacentHTML(), Element.outerHTML

insert figure 0050