Latest web development tutorials

HTML DOM value property

Property Object Reference Attribute object

Examples

Returns property values:

document.getElementsByTagName("button")[0].attributes[0].value;

Output:

myfunction()

try it"

Set property values

Examples

Set the style attributes of the head element:

var h=document.getElementsByTagName("H1")[0];
h.getAttributeNode("style").value="color:green";

style property changes before:

Hello World

style property Review:

Hello World


try it"

Definition and Usage

value property sets or returns the value of the property.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute value


grammar

Set property values

attribute .value= value

Returns property values

attribute .value

technical details

return value: String value represents the property.
DOM version Core Level 1


Property Object Reference Attribute object