Getting Element’s Attribute Value
The getAttribute() method is used to get the current value of a attribute on the element.
If the specified attribute does not exist on the element, it will return null.
Example :
Setting Attributes on Elements
The setAttribute() method is used to set an attribute on the specified element.
If the attribute already exists on the element, the value is updated; otherwise a new attribute is added with the specified name and value.
Example :
Removing Attributes from Elements
The removeAttribute() method is used to remove an attribute from the specified element. Example
Example :