We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

HTMLElement Redirect 1

The HTMLElement interface represents any HTML element. Some elements directly implement this interface, other implement it via an interface that inherit it.


Inherits properties from its parent, Element, and from GlobalEventHandlers.

Name Type Description
HTMLElement.accessKey DOMString The access key assigned to the element.
HTMLElement.accessKeyLabel DOMString A string that represents the element's assigned access key.
HTMLElement.contentEditable DOMString Gets/sets whether or not the element is editable.
HTMLElement.isContentEditable Read only Boolean Indicates whether or not the content of the element can be edited.
HTMLElement.dataset Read only DOMStringMap Allows access to read and write custom data attributes (data-*) of the element.
HTMLElement.dir DOMString Gets/sets the directionality of the element.
HTMLElement.draggable Boolean  
HTMLElement.dropzone Read only DOMSettableTokenList  
HTMLElement.hidden Boolean  
HTMLElement.itemScope Boolean  
HTMLElement.itemType Read only DOMSettableTokenList  
HTMLElement.itemId DOMString  
HTMLElement.itemRef Read only DOMSettableTokenList  
HTMLElement.itemProp Read only DOMSettableTokenList  
HTMLElement.itemValue any  
HTMLElement.lang DOMString Gets/sets the language of an element's attributes, text, and element contents.
HTMLElement.offsetHeight Read only double The height of an element, relative to the layout.
HTMLElement.offsetLeftRead only double The distance from this element's left border to its offsetParent's left border.
HTMLElement.offsetParentRead only Element The element from which all offset calculations are currently computed.
HTMLElement.offsetTopRead only double The distance from this element's top border to its offsetParent's top border.
HTMLElement.offsetWidthRead only double The width of an element, relative to the layout.
HTMLElement.properties Read only HTMLPropertiesCollection  
HTMLElement.spellcheck Boolean Controls spell-checking (present on all HTML elements)
HTMLElement.style CSSStyleDeclaration An object representing the declarations of an element's style attributes.
HTMLElement.tabIndex long Gets/sets the position of the element in the tabbing order.
HTMLElement.title DOMString A string that appears in a popup box when mouse is over the element.
HTMLElement.translate Boolean  

Event handlers

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

Returns the event handling code for the touchstart event.
Returns the event handling code for the touchend event.
Returns the event handling code for the touchmove event.
Returns the event handling code for the touchenter event.
Returns the event handling code for the touchleave event.
Returns the event handling code for the touchcancel event.


Inherits methods from its parent, Element.

Name & Arguments Return Description
HTMLElement.blur() void Removes keyboard focus from the currently focused element.
HTMLElement.click() void Sends a mouse click event to the element.
HTMLElement.focus() void Makes the element the current keyboard focus.
HTMLElement.forceSpellCheck() void  


Specification Status Comment
CSS Object Model (CSSOM) View Module Working Draft Added the following properties: offsetParent, offsetTop, offsetLeft, offsetWidth, and offsetHeight.
WHATWG HTML Living Standard Living Standard Added the following properties: translate, itemScope, itemType, itemId, itemRef, itemProp, properties, and itemValue.
Added the following method: forceSpellcheck().
Moved the onXYZ attributes to the GlobalEventHandlers interface and added an inheritance from it.
HTML5 Candidate Recommendation Added the following properties: dataset, hidden, tabindex, accessKey, accessKeyLabel, draggable, dropzone, contentEditable, isContentEditable, contextMenu, spellcheck, commandType, commandLabel, commandIcon, commandHidden, commandDisabled, commandChecked, style, and all the onXYZ properties.
Moved the id and className properties to the Element interface.
Document Object Model (DOM) Level 2 HTML Specification Recommendation No change from Document Object Model (DOM) Level 2 HTML Specification
Document Object Model (DOM) Level 1 Specification Recommendation Initial definition.

Browser compatibility

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support 1.0 (1.7 or earlier) ? ? ? ?
accessKey 5.0 (5.0) 17.0 ? ? (Yes)(535.10)
accessKeyLabel 8.0 (8.0) ? ? ? Not supportedWebKit bug 72715
blur() 5.0 (5.0) ? ? ? ?
click() 5.0 (5.0) ? ? ? (Yes)(535.24)
dataset 6.0 (6.0) 9.0 ? 11.10 5.1
focus() 5.0 (5.0) ? ? ? ?
contentEditable 3.0 (1.9) (Yes) 5.5 9 (Yes)
spellcheck 2.0 (1.8.1) ? ? ? ?
forceSpellCheck() Not supported Not supported Not supported Not supported Not supported
dataset 6.0 (6.0) 8.0 11 11.10 6
draggable (Yes) ? ? 12.0 ?
dropzone Not supported Not supported Not supported 12.0 Not supported
offsetLeft, offsetTop, offsetParent, offsetHeight and offsetWidth (Yes) ? (Yes) ? ?
translate Not supported Not supported Not supported Not supported Not supported
itemScope, itemType, itemRef, itemId, itemProp, and itemValue 6.0 (6.0) Not supported Not supported 11.60
(Removed in Opera 15)
Not supported
properties (Yes) ? ? ? ?
HTMLElement.ontouchstart, HTMLElement.ontouchend, HTMLElement.ontouchmove, HTMLElement.ontouchenter, HTMLElement.ontouchleave, and HTMLElement.ontouchcancel (Yes) (Yes) Not supported ? (Yes)
Feature Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
Basic support

1.0 (1.0)

? ? ? ?
accessKey 5.0 (5.0)
accessKeyLabel 8.0 (8.0)
blur() 5.0 (5.0)
click() 5.0 (5.0)
dataset 6.0 (6.0)
focus() 5.0 (5.0)

See also

Document Tags and Contributors

Last updated by: Sheppy,