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 June 2018.
值
一個 HTMLHeadElement
。
範例
html
<!doctype html>
<head id="my-document-head">
<title>範例:使用 document.head</title>
</head>
<script>
const theHead = document.head;
console.log(theHead.id); // 「my-document-head」;
console.log(theHead === document.querySelector("head")); // true
</script>
備註
規範
Specification |
---|
HTML # dom-document-head-dev |