//扩展方法 $.extend($.fn.tree.methods, { getLevel:function(jq,target){ var l = $(target).parentsUntil("ul.tree","ul"); return l.length+1; } }); //用法 var node = $().tree("getSelected"); var lv = $().tree("getLevel",node.target);
//扩展方法 $.extend($.fn.tree.methods, { getLevel:function(jq,target){ var l = $(target).parentsUntil("ul.tree","ul"); return l.length+1; } }); //用法 var node = $().tree("getSelected"); var lv = $().tree("getLevel",node.target);
转载于:https://www.cnblogs.com/hubing/p/4032828.html