Called when toolbar item is clicked.
onClick = function(event)
You can add event listener during the object creation: $('#toolbar').w2toolbar({ name : 'toolbar', items : [ { type: 'check', id: 'item1', text: 'Check', img: 'icon-page', checked: true }, { type: 'radio', id: 'item3', group: '1', text: 'Radio 1', img: 'icon-add' }, { type: 'radio', id: 'item4', group: '1', text: 'Radio 2', img: 'icon-add' } ], onClick: function(event) { console.log('item '+ event.target + ' is clicked.'); } }); or after the object has been created: w2ui.toolbar.on('click', function(event) { console.log('item '+ event.target + ' is clicked.'); }); You can add a listener to a toolbar item, see .items property. If toolbar item is a menu, then the event will have a reference to a menu item user clicked (if any).
The event handler is called before the default action of the event is triggered. You can cancel the default action by calling event.preventDefault(). To perform an action after the event is fully processed, define event.onComplete function.
See events page in utilities for more details.