I want to create filter buttons for my posts this my html code
<div id='filter'>
<button class='arts'>Arts</button>
<button class='sport'>Sports</button>
<button class='games'>Games</button>
</div>
<div id='posts'>
<div class='post sport'></div>
<div class='post arts'></div>
<div class='post games'></div>
<div class='post games sport'></div>
<div class='post arts'></div>
<div class='post sport'></div>
<div class='post games'></div>
</div>
and i use this jquery code
$("#filter button").each(function() {
$(this).on("click", function(){
var filtertag = $(this).attr('class');
$('.post').hasClass(':not(filtertag)').hide();
});
});
but this not working with me so plz give me the right way to do that
$('.post-outer')supposed to select?$('.post')