Run
Online Code Editor
JavaScript setAttribute() method
It is an example of adding an attribute using the setAttribute() method.
javaTpoint.com
Click the follwing button to see the effect.
Add attribute