We can set the attributes for any
HTML element using the setAttribute
method.
In the example given above, we are
setting the src
attribute for
the img
element. When using setAttribute
,
we need to provide the property name
and the value of the property.