Set a Function as an Event Handler with BX24.bind
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
The method BX24.bind sets the function func as the event handler for the event eventName on the page element element.
void BX24.bind(DOMNode element, String eventName, Function func)
Parameters
Required parameters are marked with *
|
Name |
Description |
|
element* |
The HTML element on the page (DOM element) for which the handler needs to be set |
|
eventName* |
The name of the event. For |
|
func* |
The event handler function |
Code Example
How to Use Examples in Documentation
BX24.init(function () {
const button = document.getElementById('run-action');
BX24.bind(button, 'click', function () {
console.log('Button clicked');
});
});
Handling the Response
The method does not return any data (void).