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
HTML Living Standard
The definition of 'HTMLTemplateElement interface' in that specification.
Living Standard
HTML5
The definition of 'HTMLTemplateElement interface' in that specification.
Recommendation Initial definition

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
contentChrome Full support 26Edge Full support 13Firefox Full support 22IE No support NoOpera Full support 15Safari Full support 8WebView Android Full support YesChrome Android Full support 26Firefox Android Full support 22Opera Android Full support YesSafari iOS Full support 8Samsung Internet Android Full support 1.5

Legend

Full support
Full support
No support
No support

See also