javascript Element getAttribute( )
getAttribute( ) | NN 6 IE 4 DOM 1 |
getAttribute(attributeName) getAttribute(attributeName[,caseSensitivity]) |
|
Returns the value of the named attribute within the current element. If the attribute is reflected in the object model as a property, this method returns the same value as when reading the object's property. This is the preferred method for reading an element object attribute (i.e., property) value under the W3C DOM. | |
The attribute name you pass as a parameter is not case-sensitive in current browsers. IE, however, provides an optional second parameter that lets you force case-sensitivity in the attribute naming. This might encourage the reuse of the same attribute name but with different case lettersan ill-advised practice. | |
See the setAttribute( ) method for assigning values to attributes and creating new attribute/value pairs. | |
Parameters | |
| |
Returned Value | |
The W3C DOM and Netscape 6 maintain attribute values exclusively as string data types. IE, however may return an attribute value as a string, number, or Boolean. |
Powered by Linode.