getAttribute
getAttribute is a method available on DOM Element objects that retrieves the value of a specified HTML attribute as a string. It accepts the attribute’s name as an argument and returns the attribute’s value, or null if the attribute is not present on the element.
The value returned by getAttribute is the raw value as it appears in the HTML markup. This
There is also getAttributeNS for attributes that reside in a specific namespace, and getAttributeNode for retrieving
Typical usage examples include reading attributes defined in HTML, such as a link’s href, data attributes, or