HTMLElement

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

Интерфейс HTMLElement представляет собой любой элемент HTML. Некоторые элементы напрямую используют этот интерфейс, другие - через промежуточный интерфейс.

EventTarget Node Element HTMLElement

Свойства

Наследует свойства родителя, Element, и реализует их через GlobalEventHandlers и TouchEventHandlers.

HTMLElement.accessKey — ключ доступа

Эта строковая переменная DOMString отображает ключ доступа, сопоставленный элементу Element.

HTMLElement.accessKeyLabel Только для чтения

Возвращает DOMString, содержащий назначенный ключ доступа элемента.

HTMLElement.contentEditable

Является DOMString, где значение" true "означает, что элемент доступен для редактирования, а значение" false " означает, что это не так.

HTMLElement.isContentEditable Только для чтения

Возвращает Boolean, который указывает, можно ли редактировать содержимое элемента.

HTMLElement.contextMenu

Является HTMLMenuElement, представляющим контекстное меню, связанное с элементом. Может быть null

HTMLElement.dataset Только для чтения — набор данных

Возвращает domstringmap, который позволяет получить доступ к чтению и записи атрибутов пользовательских данных элемента (data-*) .

HTMLElement.dir

Is a DOMString, reflecting the dir global attribute, representing the directionality of the element. Possible values are "ltr", "rtl", and "auto".

HTMLElement.draggable

Is a Boolean indicating if the element can be dragged.

HTMLElement.dropzone Только для чтения

Returns a DOMSettableTokenList reflecting the dropzone global attribute and describing the behavior of the element regarding a drop operation.

HTMLElement.hidden

Is a Boolean indicating if the element is hidden or not.

HTMLElement.itemScope Экспериментальная возможность

Is a Boolean

HTMLElement.itemType Только для чтения Экспериментальная возможность

Returns a DOMSettableTokenList

HTMLElement.itemId Экспериментальная возможность

Is a DOMString

HTMLElement.itemRef Только для чтения Экспериментальная возможность

Returns a DOMSettableTokenList

HTMLElement.itemProp Только для чтения Экспериментальная возможность

Returns a DOMSettableTokenList

HTMLElement.itemValue Экспериментальная возможность

Returns an Object

HTMLElement.lang

Is a DOMString representing the language of an element's attributes, text, and element contents.

HTMLElement.offsetHeight Только для чтения Экспериментальная возможность

Returns a double containing the height of an element, relative to the layout.

HTMLElement.offsetLeftТолько для чтения Экспериментальная возможность

Returns a double, the distance from this element's left border to its offsetParent's left border.

HTMLElement.offsetParentТолько для чтения Экспериментальная возможность

Returns an Element that is the element from which all offset calculations are currently computed.

HTMLElement.offsetTopТолько для чтения Экспериментальная возможность

Returns a double, the distance from this element's top border to its offsetParent's top border.

HTMLElement.offsetWidthТолько для чтения Экспериментальная возможность

Returns a double containing the width of an element, relative to the layout.

HTMLElement.properties Только для чтения Экспериментальная возможность

Returns an HTMLPropertiesCollection

HTMLElement.spellcheck

Is a Boolean that controls spell-checking. It is present on all HTML elements, though it hasn't an effect on all of them.

HTMLElement.style

Is CSSStyleDeclaration, an object representing the declarations of an element's style attributes.

HTMLElement.tabIndex

Is a long representing the position of the element in the tabbing order.

HTMLElement.title

Is a DOMString containing the text that appears in a popup box when mouse is over the element.

HTMLElement.translate Экспериментальная возможность

Is a Boolean

Event handlers

Most events properties, of the form onXYZ, are defined on the GlobalEventHandlers or TouchEventHandlers, implemented by HTMLElement. A few more are specific to HTMLElement.

HTMLElement.oncopy Не стандартно

Returns the event handling code for the copy event (Firefox bug 280959).

HTMLElement.oncut Не стандартно

Returns the event handling code for the cut event (Firefox bug 280959).

HTMLElement.onpaste Не стандартно

Returns the event handling code for the paste event (Firefox bug 280959).

TouchEventHandlers.ontouchstart Не стандартно

Returns the event handling code for the touchstart event.

TouchEventHandlers.ontouchend Не стандартно

Returns the event handling code for the touchend event.

TouchEventHandlers.ontouchmove Не стандартно

Returns the event handling code for the touchmove event.

TouchEventHandlers.ontouchenter Не стандартно

Returns the event handling code for the touchenter event.

TouchEventHandlers.ontouchleave Не стандартно

Returns the event handling code for the touchleave event.

TouchEventHandlers.ontouchcancel Не стандартно

Returns the event handling code for the touchcancel event.

Methods

Inherits methods from its parent, Element.

HTMLElement.blur()

Removes keyboard focus from the currently focused element.

HTMLElement.click()

Sends a mouse click event to the element.

HTMLElement.focus()

Makes the element the current keyboard focus.

HTMLElement.forceSpellCheck() Экспериментальная возможность

Makes the spell checker runs on the element.

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

Specification
HTML
# htmlelement

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

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
HTMLElement
accessKey
accessKeyLabel
anchorElement
ExperimentalNon-standard
attachInternals
attributeStyleMap
autocapitalize
autocorrect
autofocus
beforetoggle event
beforetoggle event fires at dialog elements
beforetoggle event fires at popover elements
blur
change event
click
command event
Experimental
contentEditable
plaintext-only as a value
dataset
dir
drag event
dragend event
dragenter event
dragexit event
DeprecatedNon-standard
draggable
dragleave event
dragover event
dragstart event
drop event
editContext
Experimental
enterKeyHint
error event
focus
options.focusVisible parameter
Experimental
options.preventScroll parameter
hidden
hidePopover
inert
Element is ignored for the purposes of find-in-page.
innerText
Can be set with TrustedScript instances in HTMLScriptElement.
inputMode
isContentEditable
lang
nonce
offsetHeight
offsetLeft
offsetParent
offsetTop
offsetWidth
outerText
popover
hint value
Experimental
showPopover
source option
Experimental
Implicit anchor reference via source
Experimental
spellcheck
style
tabIndex
title
togglePopover
Returns true or false
source option
Experimental
Implicit anchor reference via source
Experimental
toggle event
toggle event fires at details elements
toggle event fires at dialog elements
toggle event fires at popover elements
translate
virtualKeyboardPolicy
Experimental
writingSuggestions

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
In development. Supported in a pre-release version.
In development. Supported in a pre-release version.
No support
No support
Experimental. Expect behavior to change in the future.
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
See implementation notes.
User must explicitly enable this feature.
Has more compatibility info.

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