Check documentation for the latest version of dhtmlxSuite onClick DHTMLX Docs

onClick

fires when the user clicks the left mouse button on an enabled, not complex menu item

void onClick(id,zoneId,cas);
idstring|number id of the clicked/hovered menu item
zoneIdstring context menu zone, if a menu rendered in the context menu mode
casobject state of CTRL/ALT/SHIFT keys during the click (pressed/not pressed)

Example

myMenu.attachEvent("onClick", function(id, zoneId, cas){
    // your code here
    // ...
 
    // cas example
    if (cas.ctrl == true) {
        // open in a new tab
    } else {
        // open on the same page
    }
 
});

Details

The cas object has the following structure (true if a key was pressed during the click):

{
    ctrl:   true/false,
    alt:    true/false,
    shift:  true/false
}
Back to top