//扩展方法 $.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);