Check documentation for the latest version of dhtmlxSuite onBeforeSelect DHTMLX Docs


fires before selection of an item is started

boolean onBeforeSelect(string|number id,boolean state);
idstring|numberid of the item
statebooleanthe selected state of the item (true when item is selected by action)
booleantrue - to trigger the default action, false - to block it


myList.attachEvent("onBeforeSelect", function (id, state){
    // your code here
    return true;


The event is blockable, returning false will block the default action.

In case of multi-select, the event fires only for items which were clicked, and it doesn't fire for the items which were selected by Shift-click or similar actions.

Back to top