# dhtmlxmenu:event_handling [DHX documentation]

DHTMLX Docs & Samples Explorer

Index
dhtmlxmenu

## Event Handling

### Available Events

There are the following available events in dhtmlxMenu:

- onClick - occurs when the user clicks the left mouse button on an enabled, not complex menu item;
- onTouch - occurs when the user first hovers over any menu item by a mouse cursor (is not applicable for the contextual menu);
- onCheckboxClick - occurs when the user clicks any checkbox item;
- onRadioClick - occurs when the user clicks any radio item;
- onXLS - occurs before data loading from XML has started;
- onXLE - occurs after data loading from XML has finished;
- onBeforeContextMenu - occurs before the moment when a contextual menu appears (can be used only for a contextual menu);
- onAfterContextMenu - occurs after the moment when a contextual menu appears (can be used only for a contextual menu).

### Attaching Event Handler

The user can add any user-defined handler to available events. To do this, he can use attachEvent() method with the following parameters:

- evName - name of the event;
- evHandler - user-defined event handler.

            menu.attachEvent(evName, evHandler);

Note: the names of the events are case-insensitive.