Get the value of the <button> element's first attribute:
The result of x will be:
More "Try it Yourself" examples below.
The value property sets or returns the value of the attribute.
Property | |||||
---|---|---|---|---|---|
value | Yes | Yes | Yes | Yes | Yes |
Return the attribute value
Set the attribute value
Value | Description |
---|---|
value | Specifies the value of the attribute |
Return Value: | A String, representing the value of the attribute |
---|---|
DOM Version | Core Level 1 |
Change the value of the src attribute of an <img> element:
Before changing the style:
After changing the style: