Element: getAttributeNodeNS() method
The getAttributeNodeNS() method of the Element interface returns the specified namespaced attribute of the specified element, as an Attr node. It returns null if the element doesn't have an attribute with the given name in the namespace.
This method is useful if you need the namespaced attribute's instance properties. If you only need the namespaced attribute's value, you can use the getAttributeNS() method instead.
If you are working with HTML documents and you don't need to specify the requested attribute as being part of a specific namespace, use the getAttributeNode() method instead.
Syntax
getAttributeNodeNS(namespace, localName)
Parameters
namespace- : A string specifying the namespace of the attribute, or
nullfor no explicit namespace.
- : A string specifying the namespace of the attribute, or
localName- : A string specifying the name of the attribute.
Return value
An Attr node for the attribute, or null if the element doesn't have an attribute with the given name in the namespace.
Specifications
Browser compatibility
See also
这篇文档对你有帮助吗?
谢谢你的反馈!