jsTree onSelect event

前端 未结 5 705
栀梦
栀梦 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:10

    With the current version it's best to use get_selected with full: true, which means that the method will return the full object(s), and not only id.

    So for example:

    $("#treeNode").jstree('get_selected', true);
    

    or:

    $("#treeNode").jstree().get_selected(true);
    

    Each element in the array will have all the properties as text or id.

提交回复
热议问题