I want to do some filter by jQuery This is my HTML
<ul id="filters" class="filter nav nav-pills">
<li><a class="filter_link" href="#" data-category="7">Shop</a></li>
<li><a class="filter_link" href="#" data-category="8">Portal</a></li>
<li><a class="filter_link" href="#" data-category="9">Website</a></li>
</ul>
<div class="col-lg-3 filter_div" data-postcat="9">
some html
</div>
<div class="col-lg-3 filter_div" data-postcat="8">
some html
</div>
and this is my JS
jQuery(document).on('click', '.filter_link', function() {
var catId = jQuery(this).data("category");
jQuery('.filter_div').each(function(i, el) {
var termId = jQuery(el).data('postcat');
});
});
i can`t understand how i can hide and show elements by click if i click on ul > li > a with attribute for example 8. i want hide all divs with data-category not 8
.attr("data-category")instead of.data("category")