Help Center

Local Navigation

Object: Element

Availability

BlackBerry® Device Software version 4.6 or later

Extends

Node

Extended by

HTMLElement

The Element object represents an element in an HTML or XML document. Elements may have attributes associated with them. You can use the Node.attributes property to retrieve a map of all the attributes attached to the element.

This object provides several methods for handling all the available attributes, individual attribute values, or individual Attr objects.

Element properties

Property name

Type

Description

Status

Availability

tagName

DOMString

The name of the element.

read only

DOM Level 2 Core

4.6 or later

Element methods

Method name

Description

Support level

Availability

getAttribute()

Retrieves the value of the attribute of the given name.

DOM 2 Core

4.6 or later

getAttributeNode()

Retrieves the attribute node of the given name.

DOM 2 Core

4.6 or later

getAttributeNodeNS()

Retrieves the attribute node with the given namespace URI and local name.

DOM 2 Core

4.6 or later

getAttributeNS()

Retrieves the value of the attribute with the given namespace URI and local name.

DOM 2 Core

4.6 or later

getElementsByTagName()

Returns a NodeList object that contains an array of an element’s descendent element nodes with the specified tag name.

DOM 2 Core

4.6 or later

getElementsByTagNameNS()

Returns a NodeList object that contains an array of an element’s descendent element nodes with the given local name and namespace URI.

DOM 2 Core

4.6 or later

hasAttribute()

Determines whether an attribute of the given name is specified on the element.

DOM 2 Core

4.6 or later

hasAttributeNS()

Determines whether an attribute of the given namespace and local name is specified on the element.

DOM 2 Core

4.6 or later

querySelector()

Returns the first element within the subtree of the current Element node that matches the specified selectors.

DOM 1 Selector

5.0 or later

querySelectorAll()

Finds elements within the subtree of the current Element that match the specified selectors, and returns them as a NodeList object.

DOM 1 Selector

5.0 or later

removeAttribute()

Removes the attribute of the given name from the element node.

DOM 2 Core

4.6 or later

removeAttributeNode()

Removes the specified attribute node from the element node.

DOM 2 Core

4.6 or later

removeAttributeNS()

Removes the attribute node with the given namespace URI and local name from the element node.

DOM 2 Core

4.6 or later

setAttribute()

Adds a new attribute to an element, and sets it to the given value.

DOM 2 Core

4.6 or later

setAttributeNode()

Adds a new attribute node to an element.

DOM 2 Core

4.6 or later

setAttributeNodeNS()

Adds a new attribute node to an element.

DOM 2 Core

4.6 or later

setAttributeNS()

Adds a new attribute to an element, and sets it to the given value.

DOM 2 Core

4.6 or later

Next topic: Object: Entity
Previous topic: DOMImplementation methods

Was this information helpful? Send us your comments.