Path: blob/main/files/en-us/web/api/attr/name/index.md
6532 views
------{{APIRef("DOM")}}
The read-only name property of the {{domxref("Attr")}} interface returns the qualified name of an attribute, that is the name of the attribute, with the namespace prefix, if any, in front of it. For example, if the local name is lang and the namespace prefix is xml, the returned qualified name is xml:lang.
The qualified name is always in lower case, whatever case at the attribute creation.
Value
A string representing the attribute's qualified name.
Example
The following example displays the qualified name of the first attribute of the two first elements, when we click on the appropriate button.
HTML Content
JavaScript Content
{{ EmbedLiveSample('Example','100%',100) }}
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
The properties {{domxref("Attr.localName")}}, returning the local part of the qualified name of the attribute, and {{domxref("Attr.prefix")}}, the namespace prefix.
The {{domxref("Element.tagName()")}} property, returning the qualified name of an {{domxref("Element")}}.