DHTMLX Docs & Samples Explorer

Index
dhtmlxtoolbar
Event Handling

## onClick

onClick event can be applied to Button or Select Button items only. This event calls user-defined handlers (if there are any) and passes item's id parameter:

        toolbar.attachEvent("onClick", function(id){});

Now let's attach an event handler for “onClick” event:

        toolbar.attachEvent("onClick", function(id){
            alert("Button "+id+" was clicked");
        });