Learn HTML DOM
Manipulating DOM Elements
4.16
Lesson

Set Attributes for an Element

We can set the attributes for any HTML element using the setAttribute method.