getAttribute returns the value of the named attribute on the current node.
Syntax
attribute = element.getAttribute(name)
Parameters
name is the name of the attribute whose value you want to get.
Example
div1 = document.getElementById("div1");
a = divvy.getAttribute("align");
alert(a); // shows the value of align for that DIV
|
Notes
getAttribute is another very common and useful method for web developers. The corollary to this method is setAttributeNS, which allows you to change the value of a named attribute.
Specification
core