开发者

jstree select element which contains exact string

开发者 https://www.devze.com 2023-01-10 23:05 出处:网络
I must check some nodes of my jstree (checkbox plugin) on page load $j(\"#tree_data\").jstree(\"check_node\",\'a:c开发者_开发知识库ontains(\'+tool_name+\')\');

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

精彩评论

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