Alexander Suraphel Alexander Suraphel - 1 year ago 203
Javascript Question

How do I make jstree to select node only on left click?

Currently both left and right click select the node which interferes contextmenu as I use left clicks to go to other pages. How do I make

event know which mouse button is being clicked?

Answer Source

Because I wanted the click event to be fired on left click I return false when the click event is fired for right click.

$("#orgTree").bind("select_node.jstree", function(event, data) {

            var evt =  window.event || event;
            var button = evt.which || evt.button;

            if( button != 1 && ( typeof button != "undefined")) return false; 


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download