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:


Cover of Head First JavaScript Programming


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