Name

Element.hasAttributeNS( ): determine whether this element has a specified attribute — DOM Level 2 Core:

Synopsis

boolean hasAttributeNS(StringnamespaceURI,
                       String localName);

Arguments

namespaceURI

The unique namespace identifier for the attribute, or null for no namespace.

localName

The name of the attribute within the specified namespace.

Returns

true if this element has an explicitly specified value or a default value for the specified attribute; false otherwise.

Description

This method works like hasAttribute( ), except that the attribute to be checked for is specified by namespace and name. This method is useful only with XML documents that use namespaces.

See Also

Element.getAttributeNS( ), Element.hasAttribute( ), Element.setAttributeNS( )

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.