Element

In HTML and XML, an element is an individual component of a document. Documents are composed of a tree of elements and other nodes, such as text nodes. Each element can have attributes specified. Elements can also have content, including other elements and text. Elements often represent semantics, or meaning. For example, the element represents the title of the document. In code, elements are represented by tags.

Every instance of this interface will, in practice, also implement EventTarget, so those members are also documented here.

Properties
These properties are available on all Element instances.

Methods
These methods are available on all Element instances.

addEventListener
Registers listener to be called when an event of the specified type occurs on this element or a descendant. (type does not start with "on.") useCapture indicates which phases the listener may be invoked in. When in doubt, pass  as the third parameter; see here for a detailed explanation.

For Internet Explorer 8 and before, see attachEvent below.

attachEvent
Registers listener to be called when an event of the specified type occurs on this element or a descendant. (type does start with "on.") This method is essentially equivalent to calling addEventListener with   as the third parameter, except that   is always true within the listener, and   is a global variable.

getElementsByTagName
Finds every descendant of this element which has the specified tagName and is contained by the current element. The asterisk ("*") matches all elements below this one.

getElementsByTagNameNS
Finds every descendant of this element which has the specified tagName and namespace and is contained by the current element. If the name is only the asterisk ("*"), all elements below this one in the specified namespace will be returned.