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 |
---|
HTML Standard (HTML) # dom-template-content-dev |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
content |
26 |
13 |
22 |
No |
15 |
8 |
≤37 |
26 |
22 |
Yes |
8 |
1.5 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content