The HTMLTemplateElement.content
property returns a <template>
element's template contents (a DocumentFragment
).
On this page
HTMLTemplateElement: content property
Value
Examples
js
const templateElement = document.querySelector("#foo");
const documentFragment = templateElement.content.cloneNode(true);
Specifications
Specification |
---|
HTML Standard # 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 | 4.4 | 26 | 22 | 14 | 8 | 1.5 |
See also
© 2005–2023 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