DOM

Document.head プロパティ

 編集:2022.09.01 by T.A.

[Edge]読取専用。→

Document の <head> 要素を返します。

構文
Document.head

HTMLHeadElement

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

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>

テスト