gpt4 book ai didi

javascript - jsTree : How to get all leaf nodes from jstree?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:49:48 26 4
gpt4 key购买 nike

我想从 jsTree 获取所有叶节点(节点的 ID 和文本)?

我没有使用复选框 ui:jsTree。

   Root
-----A
-----A1
-----A1.1

-----A2
-----A2.1

-----B

-----B2

-----C
-----C1
-----C1.1

我想要来自 jsTree 的叶节点列表。

预期输出:[A1.1、A2.1、B2、C1.1]

如有任何帮助或指导,我们将不胜感激。

最佳答案

是这样的吗?

$('.jstree-leaf').each(function(){
var id = $(this).attr('id');
var text = $(this).children('a').text();
});

关于javascript - jsTree : How to get all leaf nodes from jstree?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10293869/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com