Here are some of the important properties of this object:
– attr.isId: using this property we can see if the attribute is an id or not. Basically, we can see if the argument of the getAttributeNode() method was “id” or not. It returns the value true if it is “id” attribute and false otherwise.
– attr.name: this property returns the name of the attribute (the value that was set as the argument of the method).
– attr.value: this property returns the value of the specified attribute. (Note, if the attribute does not have a value, the return value might be an empty string or null).
– attr.specified: this property specifies if the target attribute is declared and has a value associated with it or not.
Element getAttributeNode() Method Syntax:
Element getAttributeNode() Method Parameter
The method takes one argument and that is the name of the attribute we want to get an Attribute object from it.
Element getAttributeNode() Method Return Value
The return value of this method is an Attribute object that has methods and properties that allow us to work with the target attribute.
For example, using this object, we can get the name and value of the specified attribute.