我的函數根據data屬性返回一個已過濾的(數組)項目列表。如何將它變成可鏈式jquery函數?
我想,如果我可以讓這個功能可鏈接:
$(document).ready(function(){
function filterSvcType (svcType) {
var selectedServices = $("#service-list div");
var chose = selectedServices.filter(function() {
return $(this).data("service-type") == svcType;
});
console.log(chose);
}
filterSvcType("hosting");
});
我想要做的就是這樣稱呼它:
filterSvcType("hosting").fadeOut();
我該怎麼辦呢?
太棒了!向我展示如何將其變成插件的獎勵點。只是試圖做到這一點 –