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

前端 未结 6 683
南方客
南方客 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 01:52

    It's a bit different to get the data out for me, but otherwise GiddyUpHorsey's answer was spot-on. Here is the code again:

            jstree.bind("dblclick.jstree", function (e, data) {
                var node = $(e.target).closest("li");
                var id = node[0].id; //id of the selected node
            });
    

提交回复
热议问题