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

前端 未结 6 697
南方客
南方客 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:51

    'dblclick.jstree' doesn't exist in last version jsTree 1.0.

    DoubleClick for node:

    $("#yourtree").delegate("a","dblclick", function(e) {
      var idn = $(this).parent().attr("id").split("_")[1];
      alert(idn); //return NodeID    
    });
    

    Insert this if you want just dblclicked node

    if (this.className.indexOf('icon') == -1) {  /* is the node clicked a leaf? */ }
    

提交回复
热议问题