jsTree onSelect event

前端 未结 5 700
栀梦
栀梦 2021-02-18 20:39

I\'ve been trying to get the text of a node that is selected in a jsTree. I am able to populate the tree and trigger the onSelect event, but I can\'t find out which node was cli

5条回答
  •  北海茫月
    2021-02-18 21:30

    $("#equipment_tree").bind("select_node.jstree", function(evt, data){
    
                 var i, j, r = [], ids=[];
                    for(i = 0, j = data.selected.length; i < j; i++) {
                      r.push(data.instance.get_node(data.selected[i]).text);
                    }
                    alert('Selected: ' + r.join(', '));
               }
    );
    

    you have to try this.

提交回复
热议问题