[英]how to get child node from text?
您能告诉我如何从文本中获取子节点吗?实际上,当用户单击该节点并获得该子节点的使用价值时,
alert("node_children: " + data.node.children);
但是,现在我有一些按钮“获取子项”,当我仅使用文本单击“ a”和“ b”的“子项”按钮时,我需要获取静态文本“ a”和“ b”吗? http://jsfiddle.net/fuu94/12/
$('#home').click(function ()
{
var rootChildren = $('#tree').find('ul > li');
$(rootChildren).each(function(index, item)
{
console.log(item.id);
});
});
我能收到我的不是短信吗?
更改
$('#child').click(function () {
alert('child of b');
});
至
$('#child').click(function () {
alert($('#tree').jstree(true).get_node('b').children);
});
你的意思是这样吗?
$('#child').click(function (e) {
alert($('#tree').jstree('get_selected')[0])
});
我是否缺少某些东西,或者这可能像使用一样简单
console.log(item.text());
代替
console.log(item.id);
根据API可以使用
$.jstree._reference('#tree').get_text(node);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.