jQuery.Controller.prototype.delegate  function     

Delegate will delegate on an elememt and will be undelegated when the controller is removed. This is a good way to delegate on elements not in a controller's element.

Example:

// calls function when the any 'a.foo' is clicked.
this.delegate(document.documentElement,'a.foo', 'click', function(ev){
  //do something
})
controller.delegate(element, selector, eventName, func) -> Integer
{optional:HTMLElement|jQuery.fn} defaults to this.element

the element to delegate from

{String}

the css selector

{String}

the event to bind to

{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