HTMLElement

Example

1

Description

Properties

Property Name Description
accessKey keyboard shortcut for the element
attributes array of attributes of the element
childNodes array of child nodes of the element
className class of the element
clientHeight viewable height of the content on a page, not including borders, margins, or scrollbars
clientWidth viewable width of the content on a page, not including borders, margins, or scrollbars
dir text layout direction of the element
disabled if true, user will not be able to interact with element
firstChild first child of the element
height height of the element
id id of the element
innerHTML HTML content of the element
lang language code of the element
lastChild last child of the element
length length of the element
nextSibling element which follows this element at the same level of the tree structure
nodeName returns the tagname of an element
nodeType type of the element
nodeValue value of the element
offsetHeight height of the element, including borders and padding, but not margins
offsetLeft horizontal position of the current element relative to its offset container
offsetParent the offset container of an element
offsetTop vertical position of the current element relative to its offset container
offsetWidth width of an element, including borders and padding, but not margins
ownerDocument the root document object for the element
parentNode parent node of the element
previousSibling element immediately before this one, at the same level of the tree structure
scrollHeight entire height of the element including hidden areas
scrollLeft distance between the actual left edge of an element and the left edge currently in view
scrollTop distance between the actual top edge of an element and the top edge currently in view
scrollWidth entire width of the element including hidden areas
style style properties for the element
tabIndex tab order of the element
tagName tag name of the element
title title of the element
width width of the element

Methods

Method Name Description Values
blur() Removes input focus from the element.
click() Simulates a mouse click on the element.
cloneNode() Returns a copy of the element. If deep = true, then all of the node's descendants are copied also.
focus() Sets input focus on the element.
getAttribute() Returns the value of the named attribute.
getElementsByTagName() Returns a NodeList of all child elements with the specified tag name.
hasChildNodes() Returns whether the element has any children.
insertBefore() Inserts a new element before the specified existing element, or as the last child if existingElement is not specified.
item() Returns the node at the specified index in the node list.
normalize() Merges adjacent Text nodes that are children of this element into one Text node.
removeAttribute() Removes the named attribute from the element.
removeChild() Removes the given immediate child node from the element.
replaceChild() Replaces the given child node of the element with a new one.
setAttribute() Adds (or replaces) the named attribute with the given value.
toString() Returns a String representation of the element.