Element.outerHTML (Property)

The outer HTML of a tag in the document.


JScript - 3.0
Internet Explorer - 4.0
Property/method value type:String primitive
JavaScript syntax:IEmyElement.outerHTML
IEmyElement.outerHTML = someHTML
Argument list:someHTMLSome new HTML content to place outside the object

The outer HTML of an HTML element is that fragment of HTML that completely contains the start and end tags of the element. The outerHTML of an <A> tag would be the complete anchor and any styled text or image tags between the <A> and </A> tags.

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

Because this property is not DOM compliant, you may want to refer to the DOM Text object and DOM CharacterData object which provide a compliant set of accessors to the content of a DOM component. The implementation of this is still somewhat vague and ambiguous and some more work needs to be done to bring the DOM compliant capabilities up to the same level of functionality. This can probably best be simulated by walking up the tree to a containing element and using innerHTML on that object.


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

insert figure 0049