bonze .filter(fn)
Narrow a selection using a predicategorye function. The callback receives (element, index, allElements).
Filter by data attribute
Each item has a data-category attribute. Filter to show only a subset.
apple
carrot
banana
milk
broccoli
cherry
cheese
spinach
// click a button
Filter by index
The predicategorye also receives the element's index and the full array.
item-0
item-1
item-2
item-3
item-4
item-5
// click a button
Filter by content
Use any DOM property or method in the predicategorye - here we test textContent.
bonze
jquery
bonzo
zepto
bonnie
cash
// click a button