Document:head 屬性
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2018年6月.
值
一個 HTMLHeadElement
。
範例
html
<!doctype html>
<head id="my-document-head">
<title>範例:使用 document.head</title>
</head>
js
const theHead = document.head;
console.log(theHead.id); // 「my-document-head」;
console.log(theHead === document.querySelector("head")); // true
備註
規範
Specification |
---|
HTML> # dom-document-head-dev> |
瀏覽器相容性
Loading…