La mia funzione restituisce un elenco filtrato (array) di elementi in base all'attributo dati.Come posso trasformarlo in una funzione jquery concatenabile?
Mi piacerebbe se ho potuto fare questa funzione chainable:
$(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");
});
Quello che voglio fare è chiamare in questo modo:
filterSvcType("hosting").fadeOut();
Come posso fare questo?
fantastico! punti bonus per avermi mostrato come trasformarlo in un plugin. Stavo solo cercando di farlo –