Javascript Reference
Categories: Attr

javascript Attr value

@March 21, 2009, 8:16 a.m.
value Firefox/Netscape/NN 6 IE 6 Chrome/Safari/DOM 1  

 

Read/Write  

Provides the value portion of the name/value pair of the attribute. Identical to the nodeValue property of the Attr node, as well as data accessed more directly via an element's getAttribute() and setAttribute() methods. If you create a new attribute object, you can assign its value via the value property prior to inserting the attribute into the element. Attribute node values are always strings, including in IE, which otherwise allows Number or Boolean data types for the corresponding properties.

 
Example
 
document.getElementById("hamlet").getAttributeNode("author").value = "Shakespeare";
 
Value

String value.

 
Default

Empty string, except in IE/Windows, which returns the string undefined (that is, not a value whose type evaluates to the undefined value).

 


Powered by Linode.