HTML DOM Document doctype property
- Previous page designMode
- Next page documentElement
- Go back one level HTML DOM Documents
Definition and usage
doctype
The property returns the document's doctype (as a DocumentType object).
If the document does not have a doctype, then doctype
The property returns null.
doctype
The property is read-only.
doctype.name
The property returns the name of the doctype.
See also:
Example
Get the doctype name of the HTML document:
const doctypeObj = document.doctype.name;
Syntax
document.doctype
Return value
Type | Description |
---|---|
Object | DocumentType object. |
Browser support
document.doctype
It is a DOM Level 1 (1998) feature.
All browsers support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | 9-11 | Support | Support | Support | Support |
- Previous page designMode
- Next page documentElement
- Go back one level HTML DOM Documents