getAttribute()

Retrieves an attribute value by name.

Syntax

var value = behavior.getAttribute(element, attributeName);

Example

var mybehavior = jsb.behavior.extend({
  onchange: function(element) {
    var maxValue = this.getAttribute(element, "max-value");
    if (element.value > maxValue) {
      alert("Too big!");
    }
  }
});

Notes

This method provides a cross-browser, safe way to perform the W3C equivalent method. Most of the time you can use the W3C method. If you are not sure then use the jsb method.

See Also