HTMLTemplateElement.content

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

Syntax

var documentFragment = templateElement.content

Example

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

Specifications

Specification Status Comment
Unknown
The definition of 'HTMLTemplateElement interface' in that specification.
Living Standard
Unknown
The definition of 'HTMLTemplateElement interface' in that specification.
Recommendation Initial definition

Browser compatibility

BCD tables only load in the browser

See also