Name

innerHTML — NN n/a IE 4 DOM n/a

Synopsis

Read/Write

The rendered text and HTML tags (i.e., all source code) between the start and end tags of the current element. If you want only the rendered text, see innerText. For the source code that includes the element’s tags, see outerHTML. A change to this property that includes HTML tags is rendered through the HTML parser, as if the new value were part of the original source code. You may change this property only after the document has fully loaded. Changes to the innerHTML property are not reflected in the source code when you view the source in the browser. This property is not supported in many objects in the Macintosh version of Internet Explorer 4.

Example

document.all.elementID.innerHTML = "How <I>now</I> brown cow?"

Value

String that may or may not include HTML tags.

Default

None.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.