开发者

jstree select element which contains exact string

I must check some nodes of my jstree (checkbox plugin) on page load

$j("#tree_data").jstree("check_node",'a:c开发者_开发知识库ontains('+tool_name+')');

but if tool_name = "aa" all nodes abaa, aaa, blaah will be checked. I need to check only the node that contains exactly "aa".


solved

$j("#tree_data").jstree("check_node",$j("a:contains("+tool_name+")").filter(function() {
        return $j(this).parent().contents().last().text().trim() == tool_name;}));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜