Document.head

Document インターフェイスの head は読み取り専用のプロパティで、現在の文書の <head> 要素を返します。

構文

var objRef = document.head;

HTMLHeadElement です。

html
<!doctype html>
<head id="my-document-head">
  <title>Example: using document.head</title>
</head>

<script>
  var theHead = document.head;

  console.log(theHead.id); // "my-document-head";

  console.log(theHead === document.querySelector("head")); // true
</script>

メモ

document.head は読取専用です。このプロパティに値を代入した場合は、暗黙に失敗するか、 Strict モードの場合は、 TypeError を投げます。

仕様書

Specification
HTML Standard
# dom-document-head-dev

ブラウザーの互換性

BCD tables only load in the browser

関連情報