How can I attach custom behaviour to a double click in jsTree?

前端 未结 6 719
南方客
南方客 2020-12-31 01:18

I\'m using the jsTree jQuery plugin and want to execute code when the user double clicks a node.

I can\'t seem to get it to work. I found some documentation on a

6条回答
  •  感动是毒
    2020-12-31 02:00

    It turns out I can do this:

    jstree.bind("dblclick.jstree", function (event) {
       var node = $(event.target).closest("li");
       var data = node.data("jstree");
       // Do my action
    });
    

    node contains the li that was clicked and data contains the metadata with my info in it.

提交回复
热议问题