# dhtmlxmenu:api_method_dhtmlxmenuobject_attachevent [DHX documentation]

DHTMLX Docs & Samples Explorer

Index
dhtmlxmenu
API Methods

### attachEvent(original, catcher, CallObj)

Required library edition:
Required library file: dhtmlxmenu.js

attaches an event handler

- original - event's original name;
- catcher - event handler;
- CallObj - object that will call the event.

Several handlers can be attached to one and the same event, and all of them will be executed.

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

        menu.attachEvent("onClick", function(id){
            // code here
        });
        // or
        function doOnClick(){
            // code here
        }
        menu.attachEvent("onClick", doOnClick);