Called when user selects and item from the context menu.
onClick = function(event)
You can add event listener during the object creation: $('#sidebar').w2sidebar({ name : 'sidebar', nodes: [ { id: 'id-1', text: 'Level 1' }, { id: 'id-2', text: 'Level 2' }, { id: 'id-3', text: 'Level 3' } ], onMenuClick: function(event) { console.log(event); } }); or after the object has been created: w2ui.sidebar.on('menuClick', function(event) { console.log(event); }); The event will only be triggered if you defined the .menu property for the sidebar. This property is used for context menu when any of the sidebar items is clicked.
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.