HTML DOM Document doctype property
- Föregående sida designMode
- Nästa sida documentElement
- Gå tillbaka till föregående nivå 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 web browsers support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Stöd | 9-11 | Stöd | Stöd | Stöd | Stöd |
- Föregående sida designMode
- Nästa sida documentElement
- Gå tillbaka till föregående nivå HTML DOM Documents