content attribute | content property
Returns the contents of a template element, which are stored in a DocumentFragment associated with a different document so as to avoid the template contents interfering with the main document.
This property is read-only.
![]() |
Syntax
| HTML |
|---|
<element content="" ... > |
Standards information
- HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.12.13
Remarks
The content attribute can be used to determine if a browser supports the template element.
Examples
The following is an example of how the content attribute can be used to determine if the template element is supported by a browser.
if ('content' in document.createElement('template')) { . . . }
See also
Show:
