This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

hasAttributeNS

Summary

Determines whether a content attribute in a specified namespace exists on an element.

Method of dom/Elementdom/Element

Syntax

var attributeExists = element.hasAttributeNS(namespaceURI, name);

Parameters

namespaceURI

Data-type
String

The namespace URI that defines the attribute name, or null.

name

Data-type
String

The name of the attribute.

Return Value

Returns an object of type BooleanBoolean

Whether the specified attribute exists.

Usage

 Use this method to determine whether a content attribute in a specified namespace exists on an element.

Notes

  • This method does not get the value of the attribute, see getAttributeNS for this purpose.
  • Where namespaces are irrelevant, hasAttribute can be used instead.
  • See hasAttributes, which determines whether the element has any attributes at all.

Related specifications

Document Object Model (DOM) Level 3 Core
Recommendation
Document Object Model (DOM) Level 2 Core
Recommendation
DOM
Living Standard

Attributions