The HTMLElement interface represents any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it.
The HTMLElement interface represents any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it.
Inherits properties from its parent, Element.
HTMLElement.accessKeyA string representing the access key assigned to the element.
HTMLElement.accessKeyLabel Read only 
Returns a string containing the element's assigned access key.
HTMLElement.attributeStyleMap Read only 
A StylePropertyMap representing the declarations of the element's style attribute.
HTMLElement.contentEditableA string, where a value of true means the element is editable and a value of false means it isn't.
HTMLElement.isContentEditable Read only 
Returns a boolean value indicating whether or not the content of the element can be edited.
HTMLElement.dataset Read only 
Returns a DOMStringMap with which script can read and write the element's custom data attributes (data-*) .
HTMLElement.dirA string, reflecting the dir global attribute, representing the directionality of the element. Possible values are "ltr", "rtl", and "auto".
HTMLElement.draggableA boolean value indicating if the element can be dragged.
HTMLElement.enterKeyHintA string defining what action label (or icon) to present for the enter key on virtual keyboards.
HTMLElement.hiddenA string or boolean value reflecting the value of the element's hidden attribute.
HTMLElement.inertA boolean value indicating whether the user agent must act as though the given node is absent for the purposes of user interaction events, in-page text searches ("find in page"), and text selection.
HTMLElement.innerText Represents the rendered text content of a node and its descendants. As a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the clipboard. As a setter, it replaces the content inside the selected element, converting any line breaks into <br> elements. 
HTMLElement.inputModeA string value reflecting the value of the element's inputmode attribute.
HTMLElement.popoverGets and sets an element's popover state via JavaScript ("auto" or "manual"), and can be used for feature detection. Reflects the value of the popover global HTML attribute.
HTMLElement.langA string representing the language of an element's attributes, text, and element contents.
HTMLElement.noModuleA boolean value indicating whether an import script can be executed in user agents that support module scripts.
HTMLElement.nonceReturns the cryptographic number used once that is used by Content Security Policy to determine whether a given fetch will be allowed to proceed.
HTMLElement.offsetHeight Read only 
Returns a double containing the height of an element, relative to the layout.
HTMLElement.offsetLeft Read only 
Returns a double, the distance from this element's left border to its offsetParent's left border.
HTMLElement.offsetParent Read only 
An Element that is the element from which all offset calculations are currently computed.
HTMLElement.offsetTop Read only 
Returns a double, the distance from this element's top border to its offsetParent's top border.
HTMLElement.offsetWidth Read only 
Returns a double containing the width of an element, relative to the layout.
HTMLElement.outerText Represents the rendered text content of a node and its descendants. As a getter, it is the same as HTMLElement.innerText (it represents the rendered text content of an element and its descendants). As a setter, it replaces the selected node and its contents with the given value, converting any line breaks into <br> elements. 
HTMLElement.properties  Experimental  Read only 
Returns a HTMLPropertiesCollection…
HTMLElement.spellcheckA boolean value that controls spell-checking. It is present on all HTML elements, though it doesn't have an effect on all of them.
HTMLElement.styleA CSSStyleDeclaration representing the declarations of the element's style attribute.
HTMLElement.tabIndexA long representing the position of the element in the tabbing order.
HTMLElement.titleA string containing the text that appears in a popup box when mouse is over the element.
HTMLElement.translateA boolean value representing the translation.
Inherits methods from its parent, Element.
HTMLElement.attachInternals()Returns an ElementInternals object, and enables a custom element to participate in HTML forms.
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.hidePopover()Hides a popover element by removing it from the top layer and styling it with display: none.
HTMLElement.showPopover()Shows a popover element by adding it to the top layer and removing display: none; from its styles.
HTMLElement.togglePopover()Toggles a popover element between the hidden and showing states.
Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface.
copyFired when the user initiates a copy action through the browser's user interface.
cutFired when the user initiates a cut action through the browser's user interface.
pasteFired when the user initiates a paste action through the browser's user interface.
invalidFired when an element does not satisfy its constraints during constraint validation.
beforetoggleFired when the element is a popover, before it is hidden or shown.
toggleFired when the element is a popover, just after it is hidden or shown.
animationcancelFired when an animation unexpectedly aborts.
animationendFired when an animation has completed normally.
animationiterationFired when an animation iteration has completed.
animationstartFired when an animation starts.
beforeinputFired when the value of an <input>, <select>, or <textarea> element is about to be modified.
inputFired when the value of an <input>, <select>, or <textarea> element has been changed.
changeFired when the value of an <input>, <select>, or <textarea> element has been changed and committed by the user. Unlike the input event, the change event is not necessarily fired for each alteration to an element's value.
gotpointercaptureFired when an element captures a pointer using setPointerCapture().
lostpointercaptureFired when a captured pointer is released.
pointercancelFired when a pointer event is canceled.
pointerdownFired when a pointer becomes active.
pointerenterFired when a pointer is moved into the hit test boundaries of an element or one of its descendants.
pointerleaveFired when a pointer is moved out of the hit test boundaries of an element.
pointermoveFired when a pointer changes coordinates.
pointeroutFired when a pointer is moved out of the hit test boundaries of an element (among other reasons).
pointeroverFired when a pointer is moved into an element's hit test boundaries.
pointerupFired when a pointer is no longer active.
transitioncancelFired when a CSS transition is canceled.
transitionendFired when a CSS transition has completed.
transitionrunFired when a CSS transition is first created.
transitionstartFired when a CSS transition has actually started.
| Specification | 
|---|
| HTML Standard # htmlelement | 
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
| HTMLElement | 1 | 12 | 1 | 5.5 | 8 | 1 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 
| accessKey | 17 | 12 | 5 | 5.5 | ≤12.1 | 6 | 4.4 | 18 | 5 | ≤12.1 | 6 | 1.0 | 
| accessKeyLabel | No | No | 8 | No | No | 14 | No | No | 8 | No | 14 | No | 
| attachInternals | 77 | 79 | 93 | No | 64 | 16.4 | 77 | 77 | 93 | 55 | 16.4 | 12.0 | 
| attributeStyleMap | 66 | 79 | No | No | 53 | 16.4 | 66 | 66 | No | 47 | 16.4 | 9.0 | 
| autocapitalize | 66 | 79 | 111 | No | 53 | No | 66 | 66 | 111 | 47 | 10.3 | 9.0 | 
| autofocus | 79 1–79Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 79 12–79Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 1Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 10Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 66 ≤12.1–66Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 15.4 4Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 79 ≤37–79Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 79 18–79Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 4Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 57 ≤12.1–57Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 15.4 3.2Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 12.0 1.0–12.0Supported forHTMLButtonElement,HTMLInputElement,HTMLSelectElement, andHTMLTextAreaElement. | 
| beforeinput_event | 60 | 79 | 87 | No | 47 | 10.1 | 60 | 60 | 87 | 44 | 10.3 | 8.0 | 
| beforematch_event | 102 | 102 | No | No | 88 | No | 102 | 102 | No | 70 | No | 19.0 | 
| beforetoggle_event | 114 | 114 | 114 | No | 100 | 17 | 114 | 114 | No | No | 17 | No | 
| blur | 1 | 12 | 1.5 | 5.5 | 8 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| change_event | 1 | 12 | 1 | 9 | 9 | 3 | 4.4 | 18 | 4 | 10.1 | 2 | 1.0 | 
| click | 9Before Chrome 19,click()is only defined on buttons and inputs. | 12 | 3["Before Firefox 5,click()is only defined on buttons and inputs, and has no effect on text and file inputs.", "Starting in Firefox 75, theclick()function works even when the element is not attached to a DOM tree."] | 5.5 | 10.5 | 6 | 4.4Before Android WebView 4.4,click()is only defined on buttons and inputs. | 18Before Chrome 19,click()is only defined on buttons and inputs. | 4["Before Firefox 5,click()is only defined on buttons and inputs, and has no effect on text and file inputs.", "Starting in Firefox for Android 79, theclick()function works even when the element is not attached to a DOM tree."] | 11 | 6 | 1.0Before Samsung Internet 1.5,click()is only defined on buttons and inputs. | 
| contentEditable | 1 | 12 | 3 | 5.5 | 9 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| dataset | 7 | 12 | 6 | 11 | 11 | 5.1 | 3 | 18 | 6 | 11 | 5 | 1.0 | 
| dir | 1 | 12 | 1 | 5.5 | ≤12.1 | 3 | 4.4 | 18 | 4 | ≤12.1 | 1 | 1.0 | 
| drag_event | 1 | 12 | 9 | 9 | 12 | 3.1 | 4.4 | 18 | 9 | 12 | 2 | 1.0 | 
| dragend_event | 1 | 12 | 9 | 9 | 12 | 3.1 | 4.4 | 18 | 9 | 12 | 2 | 1.0 | 
| dragenter_event | 1 | 12 | 9 | 9 | 12 | 3.1 | 4.4 | 18 | 9 | 12 | 2 | 1.0 | 
| dragexit_event | No | 12–79 | 3.5 | 10 | 12 | 3.1 | No | No | 4 | No | No | No | 
| draggable | 4 | 12 | 2 | 10 | 12 | 5 | 4.4 | 18 | 4 | 12 | 4 | 1.0 | 
| dragleave_event | 1 | 12 | 9 | 9 | 12 | 3.1 | 4.4 | 18 | 9 | 12 | 2 | 1.0 | 
| dragover_event | 1 | 12 | 9 | 9 | 12 | 3.1 | 4.4 | 18 | 9 | 12 | 2 | 1.0 | 
| dragstart_event | 1 | 12 | 9 | 9 | 12 | 3.1 | 4.4 | 18 | 9 | 12 | 2 | 1.0 | 
| drop_event | 1 | 12 | 9 | 9 | 12 | 3.1 | 4.4 | 18 | 9 | 12 | 2 | 1.0 | 
| enterKeyHint | 77 | 79 | 94 | No | 64 | 13.1 | 77 | 77 | 94 | 55 | 13.4 | 12.0 | 
| error_event | 1 | 12 | 1 | 9 | ≤12.1 | 1 | 4.4 | 18 | 4 | ≤12.1 | 1 | 1.0 | 
| focus | 1 | 12 | 1.5 | 5.5 | 8 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| hidden | 6 | 12 | 4 | 11 | 11.6 | 5.1 | 3 | 18 | 4 | 12 | 5 | 1.0 | 
| hidePopover | 114 | 114 | 114 | No | 100 | 17 | 114 | 114 | No | No | 17 | No | 
| inert | 102 | 102 | 112 | No | 88 | 15.5 | 102 | 102 | 112 | 70 | 15.5 | 19.0 | 
| innerText | 1 | 12 | 45 | 5.5 | 9.6 | 1 | 1 | 18 | 45 | 10.1 | 1 | 1.0 | 
| inputMode | 66 | 79 | 95 | No | 53 | 12.1 | 66 | 66 | 79 | 47 | 12.2 | 9.0 | 
| input_event | 1 | 79 12–79Not supported onselect,checkbox, orradioinputs. | 6 | 9Only supportsinputof typetextandpassword. | 11.6 | 3.1 | 4.4 | 18 | 6 | 12 | 2 | 1.0 | 
| isContentEditable | 1 | 12 | 4 | 5.5 | ≤12.1 | 3 | 4.4 | 18 | 4 | ≤12.1 | 1 | 1.0 | 
| lang | 1 | 12 | 1 | 5.5 | ≤12.1 | 3 | 4.4 | 18 | 4 | ≤12.1 | 1 | 1.0 | 
| nonce | 61 | 79 | 75 | No | 48 | 16 10–16The property is defined only for its useful elements:<link>,<script>, and<style>; it is undefined for all other elements. | 61 | 61 | 79 | 45 | 16 10–16The property is defined only for its useful elements:<link>,<script>, and<style>; it is undefined for all other elements. | 8.0 | 
| offsetHeight | 1 | 12 | 1 | 5.5 | 8 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| offsetLeft | 1 | 12 | 1 | 5.5 | 8 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| offsetParent | 1 | 12 | 1 | 5.5 | 8 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| offsetTop | 1 | 12 | 1 | 5.5 | 8 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| offsetWidth | 1 | 12 | 1 | 5.5 | 8 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| outerText | 1 | 12 | 98 | 5.5 | ≤12.1 | 1.3 | 1 | 18 | 98 | ≤12.1 | 1 | 1.0 | 
| popover | 114 | 114 | 114 | No | 100 | 17 | 114 | 114 | No | No | 17 | No | 
| showPopover | 114 | 114 | 114 | No | 100 | 17 | 114 | 114 | No | No | 17 | No | 
| spellcheck | 9 | 12 | 2 | 10 | ≤12.1 | 5.1 | 3 | 18 | 4 | ≤12.1 | 5 | 1.0 | 
| style | 1 | 12 | 1 | 5.5 | 8 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 | 
| tabIndex | 1 | 18 12Returns incorrect value for elements without an explicit tabindex attribute. See issue 4365703 for details. | 1 | 5.5Returns incorrect value for elements without an explicit tabindex attribute. See issue 4365703 for details. | ≤12.1 | 3.1 | 4.4 | 18 | 4 | ≤12.1 | 2 | 1.0 | 
| title | 1 | 12 | 1 | 5.5 | ≤12.1 | 3 | 4.4 | 18 | 4 | ≤12.1 | 1 | 1.0 | 
| togglePopover | 114 | 114 | 114 | No | 100 | 17 | 114 | 114 | No | No | 17 | No | 
| toggle_event | 114 | 114 | 114 | No | 100 | 17 | 114 | 114 | No | No | 17 | No | 
| translate | 19 | 79 | 111 | No | 15 | 6 | 4.4 | 25 | 111 | 14 | 6 | 1.5 | 
| virtualKeyboardPolicy | 94 | 94 | No | No | 80 | No | 94 | 94 | No | 66 | No | 17.0 | 
    © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement