How to filter a number of divs based on what they have in their custom data attribute using jQuery? The problem is that the attribute can have more than 1 value
data
Using this css filter element[attr*=partial] will find any element that contains that partial in the attribute
element[attr*=partial]
function filter(e){ $('.size').hide() .filter('[data-sizes*="'+ e +'"]') .show(); // show the filtered elements }
And its pure css selector, there are more checkout here