Skip to content

Instantly share code, notes, and snippets.

@techwraith
Created December 7, 2010 01:51
Show Gist options
  • Save techwraith/731348 to your computer and use it in GitHub Desktop.
Save techwraith/731348 to your computer and use it in GitHub Desktop.
jQuery list filter
var pFilters = [];
function togglePotatoes(pType) {
if (pFilters.indexOf(pType) > -1) {
pFilters.splice(pFilters.indexOf(pType),1);
} else {
pFilters.push(pType);
}
console.log(pFilters.join(","));
$(pFilters.join(",")).hide('fast');
$("#potatoes li").not($(pFilters.join(","))).show('fast');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment