Name
HTMLElement.setAttribute( ) — set the value of an attribute
Availability
Internet Explorer 4, Netscape 6
Synopsis
element
.setAttribute(name
,value
)
Arguments
-
name
The name of the attribute to set.
-
value
The value to set it to.
Description
setAttribute( )
sets the attribute
name
of element
to value
.
Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.