亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

JSLite線上手冊 / JSLite - 過濾

JSLite - 過濾

如有疑問歡迎到這些地方交流,歡迎加入JSLite.io組織團(tuán)伙共同開發(fā)!

filter

篩選出與指定表達(dá)式匹配的元素集合。
filter(selector)
filter(function(index){ ... }) 篩選出與 指定表達(dá)式匹配的元素集合。

$("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
篩選出與 指定表達(dá)式匹配的元素集合。它的作用剛好與 filter 相反,返回。

$("#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"
})