Documentation

BX.bind

void 
BX.bind(
Object|DOMNode el, 
String event, 
Function handler
);

Function sets the handler function as the event handler for the el element.

Note

It's preferable to use BX.delegate (или BX.proxy). It will allow:

  1. execute BX.unbind
  2. not to create an excessive code плодить код, а вешать один и тот же обработчик на несколько элементов.

Examples of use

BX.bind(BX('test'), 'click', function() {alert('click!')})

To retrieve directly the element, on which you have clicked.

_hadleMoreButtonClickHandler: function(e)
{
   alert(BX.proxy_context.innerHTML);
}

BX.bind(BX('test'), 'click', BX.delegate(this._hadleMoreButtonClickHandler, this));


© «Bitrix24», 2001-2024
Up