setAttribute
Summary
Sets the value of a content attribute.
Method of dom/Elementdom/Element
Syntax
element.setAttribute(name, value);
Parameters
name
- Data-type
- String
The name of the attribute.
value
- Data-type
- String
The value of the attribute.
Return Value
No return value
Notes
- The attribute will be created, if it is not already present.
Related specifications
- Document Object Model (DOM) Level 3 Core
- Recommendation
- Document Object Model (DOM) Level 2 Core
- Recommendation
- Document Object Model (DOM) Level 1
- Recommendation
- DOM
- Living Standard
See also
Related pages
- removeAttributeremoveAttribute
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]