setAttribute
The setAttribute method sets the value of the specified attribute on the element. If the value already exists, it will be updated; otherwise, a new attribute with the specified name and value will be added to the element.
Syntax
element.setAttribute(attributeName, value);
Parameters
attributeName: string- The name of the attribute to set.
value: string- The value to assign to the attribute.