How to add attribute using javascript

There are different ways to add an attribute to the element.  One way is to first create the attribute and then assign value to that attribute.  Once it is created the attribute, you can set it to the element using setAttributeNode().  Here is an example:  Another way is to set the attribute using setAttribute(attribute, value) …

How to add attribute using javascript Read More »