hasAttribute()

Returns a boolean indicating if the supplied element has the supplied attribute.

Syntax

var result = behavior.hasAttribute(element, attributeName);

Example

var mybehavior = jsb.behavior.extend({
  onclick: function(element, event) {
    if (this.hasAttribute(element, "disabled")) {
      event.preventDefault();
    }
  }
});

Notes

This method provides a cross-browser, safe way to perform the W3C equivalent method. Please note that MSIE6 does not support this method so you should always use the jsb method.

See Also