When filter button is clicked I would like it to hide all the li where the data attribute hasrelated=0
html
<li data-mostsaved="0" data-hasrelated="0" data-mostplayed="2">img</li>
JQ
$( ".has-related" ).click(function() {
if ($("li").data('hasrelated') == '0') {
$("li").hide();
}
});
$("li").datais going to fetch the FIRST<li>found in the document, grab its data attribute, and test that. You need to test EVERY<li>that has a hasrelated attribute in turn.