HTML DOM Document doctype property
- Previous Page designMode
- Next Page documentElement
- Go to the Previous Level HTML DOM Documents
Definition and usage
doctype
The property returns the doctype of the document (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 feature of DOM Level 1 (1998).
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 to the Previous Level HTML DOM Documents