1. Веб-технологии для разработчиков
  2. Интерфейсы веб API
  3. HTMLAnchorElement
  4. HTMLAnchorElement: свойство href

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

HTMLAnchorElement: свойство href

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨июль 2015 г.⁩.

Свойство HTMLAnchorElement.href — это строковый преобразователь, который возвращает строку, содержащую полный URL, и позволяет его изменять.

Значение

Строка.

Примеры

js
// Документ содержит элемент <a id="myAnchor" href="https://developer.mozilla.org/en-US/HTMLAnchorElement">
const anchor = document.getElementById("myAnchor");
anchor.href; // вернёт 'https://developer.mozilla.org/en-US/HTMLAnchorElement'

Спецификации

Specification
HTML
# dom-hyperlink-href-dev

Совместимость с браузерами

Смотрите также

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /