HTML DOM Document doctype 속성

정의와 사용법

doctype 속성은 문서의 doctype를 반환합니다(DocumentType 객체로).

문서에 doctype가 없으면 doctype 속성은 null을 반환합니다。

doctype 속성은 읽기 전용입니다。

doctype.name 속성은 doctype의 이름을 반환합니다。

다른 참조:

HTML <!DOCTYPE> 선언

예제

HTML 문서의 doctype 이름을 가져옵니다:

const doctypeObj = document.doctype.name;

직접 시도해 보세요

문법

document.doctype

반환 값

타입 설명
객체 DocumentType 객체。

브라우저 지원

document.doctype DOM Level 1 (1998) 기능입니다。

모든 브라우저가 지원합니다:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
지원 9-11 지원 지원 지원 지원