HTMLTemplateElement: content property

The HTMLTemplateElement.content property returns a <template> element's template contents (a DocumentFragment).

Value

Examples

js

const templateElement = document.querySelector("#foo");
const documentFragment = templateElement.content.cloneNode(true);

Specifications

Specification
HTML Standard
# dom-template-content-dev

Browser compatibility

BCD tables only load in the browser

See also