Dokument: head-Eigenschaft

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.

Die schreibgeschützte head-Eigenschaft des Document-Interfaces gibt das <head>-Element des aktuellen Dokuments zurück.

Wert

Beispiele

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

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

Hinweise

document.head ist schreibgeschützt. Der Versuch, dieser Eigenschaft einen Wert zuzuweisen, schlägt entweder stillschweigend fehl oder löst im Strict Mode einen TypeError aus.

Spezifikationen

Specification
HTML
# dom-document-head-dev

Browser-Kompatibilität

Siehe auch