liveBook · Manning

innerHTML

innerHTML is a DOM element property that gets or sets the serialized HTML markup representing the element’s child content.

How 2 Manning books explain it

Web Components in Action

innerHTML is a DOM property that gets or sets the serialized HTML markup contained within an element.

How it is used
Populates custom elements with markup and clears their contents when replacing a template-driven layout.
How deep it goes
Works through assignments, lifecycle timing, clearing, and exposed DOM; does not examine markup serialization internals.
Examples
Uses a slider, photo carousel, constructor failure, template-switched business card, and externally modified component.
What you can do after
Build it from scratch: populate a custom element in connectedCallback, then select its children for styling or interaction.

Read how Web Components in Action explains innerHTML →

Secrets of the JavaScript Ninja, Second Edition

A DOM element property that gets or sets HTML markup as the serialized contents of an element.

How it is used
Converts an HTML string into DOM nodes by parsing it inside a temporary element.
How deep it goes
Details markup preprocessing, required wrappers, insertion, and node extraction without developing getter behavior.
Examples
Uses option elements and table markup, including a self-closing table tag, to illustrate parsing constraints.
What you can do after
Build a DOM-node list from an HTML string by preparing markup, wrapping it, and extracting parsed children.

Read how Secrets of the JavaScript Ninja, Second Edition explains innerHTML →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.