JSLite - Filtering
If you have any questions, you are welcome to communicate in these places, and you are welcome to join the JSLite.io organization team for joint development!
filter
Filter out the set of elements that match the specified expression.
filter(selector)
filter(function(index){ ... })
Filter out elements that matchnon-
specified expressions gather.
$("div").filter("#box") //⇒ self 在所有的div对象中选择器为 #box 的过滤出来。 $("#select option").filter(function(idx){ console.log(this.selected) return this.selected }) //上面这种方法跟 not(function(index){ ... }) 是一样的
not
not(selector) ⇒ collection
not(collection) ⇒ collection
not(function(index){ ... }) ⇒ collection
Filters out the collection of elements that matchnon
specified expressions. Its function is exactly the opposite offilter
, returning.
$("#select option").not(function(idx){ console.log(this.selected) return this.selected }) //⇒ [哈哈3] $("input").not("#input") //⇒ 返回除去 匹配到的#input $('input').not(function(){ console.log(this.type) return this.type=="text" })