Document.head - head要素
headは、Documentのプロパティです。ドキュメントのhead要素を返します。
概要
- 名前
- head
- 所属
- Document
- IDL
readonly attribute HTMLHeadElement? head;
- 仕様書
- https://html.spec.whatwg.org/multipage/dom.html#dom-document-head
説明
head要素を返す。読み取り専用なので、値を代入して変更することはできない。
デモ
Document.headのデモです。
<!-- このコードは編集できます。 -->
<!DOCTYPE html>
<html>
<head>
<title>SYNCER</title>
</head>
<body>
<script>
var value = document.head ;
console.log( value ) ;
document.body.appendChild( new Text( value ) ) ;
</script>
</body>
</html>
サポート状況
Chrome | Firefox | Safari | Edge | IE | Opera | iOS Safari | Android |
---|---|---|---|---|---|---|---|
● | ● | ● 5.1+ | ● | ● 9+ | ● | ● | ● |
関連記事
- Document()
- Document()は、Documentのコンストラクタです。新しいオブジェクトを作成します。
- Document.visibilityState
- visibilityStateは、Documentのプロパティです。最上位のブラウジングコンテキストが持つドキュメントの表示状態を文字列で返します。
- Document.activeElement
- activeElementは、Documentのプロパティです。フォーカス中の要素を返します。フォーカス中の要素がなければbody要素、それもなければhtml要素、それもなければnullを返します。
- Document.forms
- formsは、Documentのプロパティです。ドキュメントの全てのform要素を返します。