Web/API/HTMLTemplateElement/content

From Get docs


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

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
content Chrome

Full support 26

Edge

Full support 13

Firefox

Full support 22

IE

No support No

Opera

Full support 15

Safari

Full support 8

WebView Android

Full support Yes

Chrome Android

Full support 26

Firefox Android

Full support 22

Opera Android

Full support Yes

Safari iOS

Full support 8

Samsung Internet Android

Full support 1.5

Legend

Full support  
Full support
No support  
No support


See also