--- title: Document.head slug: Web/API/Document/head tags: - API - Document - Property translation_of: Web/API/Document/head --- <p>{{APIRef("DOM")}}</p> <p>Возвращает элемент {{HTMLElement("head")}} текущего документа. Если имеется более одного элемента <code><head></code>, будет возвращён первый из них.</p> <h2 id="Syntax">Синтаксис</h2> <pre class="syntaxbox"><em>var objRef</em> = document.head; </pre> <h3 id="Значение">Значение</h3> <p>{{domxref("HTMLHeadElement")}}.</p> <h2 id="Пример">Пример</h2> <pre><code><!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></code></pre> <h2 id="Примечание">Примечание</h2> <p><code>document.head</code> доступно только для чтения. Присвоить значение этому свойству нельзя. При попытке это сделать ошибка вызвана не будет, только если вы не используете <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode">Strict Mode</a>. В данном случае будет вызвано {{jsxref("TypeError")}} .</p> <h2 id="Спецификации">Спецификации</h2> {{Specifications}} <h2 id="Браузерная_поддержка">Браузерная поддержка</h2> <p>{{Compat}}</p> <h2 id="Смотрите_также">Смотрите также</h2> <ul> <li>{{domxref("document.body")}}</li> </ul>