addEventListener()

Adds an event listener to an element.

Most of the time you won't need this as the behavior itself will define event handlers.

Syntax

behavior.addEventListener(element, type, listener, useCapture);

Example

var mybehavior = jsb.behavior.extend({
  onmousedown: function(element) {
    this.addEventListener(document.body, "mouseup", this.onbodymouseup, false);
  }
});

Notes

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

See Also