Help Center

Local Navigation

Object: Attr

Availability

BlackBerry® Device Software version 4.6 or later

Extends

Node

The Attr object represents an attribute in an Element object.

Although Attr objects describe Element objects, they are not actually child nodes of the element they describe. Instead, attributes are treated as properties of elements, and reside outside of the DOM tree. As a result, the Node.parentNode, Node.previousSibling, and Node.nextSibling properties are null for Attr objects.

If a declaration for an attribute exists that defines a default value, but that attribute does not yet exist, the attribute is automatically created and attached to an element with the given value.

Attr properties

Property name

Type

Description

Status

Availability

name

String

Returns the name of the attribute. The value of the name property must be unique across all attributes attached to the same Element node.

read only

4.6 or later

ownerElement

Element

Returns the element node that this attribute is attached to. If the attribute is not yet attached to an element, the value of this property is null.

read only

4.6 or later

specified

boolean

When true, this property indicates that the value for the attribute has been explicitly set.

If the attribute exists with a default value, this property has a value of false.

read only

4.6 or later

value

String

Specifies the value of the attribute.

writable

4.6 or later

Previous topic: JavaScript objects

Was this information helpful? Send us your comments.