DocumentType: phương thức remove()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Phương thức DocumentType.remove() xóa doctype của tài liệu. Nếu nó đã bị tách khỏi tài liệu, việc gọi remove() sẽ không làm gì cả.

Cú pháp

js
remove()

Tham số

Không có.

Giá trị trả về

Không có (undefined).

Ví dụ

Sử dụng remove()

js
document.doctype; // "<!doctype html>'
document.doctype.remove();
document.doctype; // null

Thông số kỹ thuật

Specification
DOM
# ref-for-dom-childnode-remove①

Tương thích trình duyệt

Xem thêm