O'Reilly logo
  • Ahmed Elgendy thinks this is interesting:

How to set an attribute with setAttribute

Element objects have a method named setAttribute that you can call to set the value of an HTML element’s attribute. The setAttribute method looks like this:

From

Cover of Head First JavaScript Programming

Note

How to set an element (element, id,class) attribute with setAttribute method?