Name

Element: an HTML or XML element — DOM Level 1 Core: Node → Element

Subinterfaces

HTMLElement

Properties

readonly String tagName

The tag name of the element. This is the string “P” for an HTML <p> element, for example. For HTML documents, the tag name is returned in uppercase, regardless of its capitalization in the document source. XML documents are case-sensitive, and the tag name is returned exactly as it is written in the document source. This property has the same value as the inherited nodeName property of the Node interface.

Methods

addEventListener( )

Adds an event-handler function to the set of event handlers for this element. This is a DOM-standard method supported by all modern browsers except IE.

attachEvent( )

Adds an event-handler function to the set of handlers for this element. This is the IE-specific alternative to addEventListener( ).

detachEvent( )

Removes an event-handler function from this element. This is the IE-specific alternative to the standard removeEventListener( ) method.

dispatchEvent( )

Dispatches a synthetic event to this node.

getAttribute( )

Returns the value of a named attribute as a string.

getAttributeNS( )

Returns the string value of an attribute specified by local name and namespace URI. Useful only with XML documents that use namespaces.

getAttributeNode( )

Returns the value of a named attribute as an Attr node.

getAttributeNodeNS( )

Returns the Attr value of an attribute specified by local name and namespace URI. Useful only with ...

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.