$("expr","expr")

$("p").filter(function(index) { return $("ol", this).length == 0; });


$("ol", this)是在this中查找ol元素 $("ol", this).length==0就是查找this中不包含ol的this元素(这里的this是<p>) return $("ol", this).length == 0;是相对filter来说的,如果return $("ol", this).length == 0为true的话保留,return $("ol", this).length == 0是false的话元素被删除 这整句话的意思就是:查找<p>中不包含<ol>的<p>元素
原文地址:https://www.cnblogs.com/mabelstyle/p/2633522.html