jQuery.Controller.prototype.bind  function     

Bind attaches event handlers that will be removed when the controller is removed.
This is a good way to attach to an element not in the controller's element.

Examples:

init: function() {
   // calls somethingClicked(el,ev)
   this.bind('click','somethingClicked') 

   // calls function when the window is clicked
   this.bind(window, 'click', function(ev){
     //do something
   })
},
somethingClicked: function( el, ev ) {

}
controller.bind(el, eventName, func) -> Integer
{optional:HTMLElement|jQuery.fn} defaults to this.element

The element to be bound

{String}

The event to listen for.

{Function|String}

A callback function or the String name of a controller function. If a controller function name is given, the controller function is called back with the bound element and event as the first and second parameter. Otherwise the function is called back like a normal bind.

{Integer}

The id of the binding in this._bindings

© Jupiter IT - JavaScriptMVC Training and Support