Reputation: 41
I have a set of filters which are in accordions. When the user clicks on one of the filter headings, I just want to show that elements fitlers. My issue is that when I click on an element header to show the filters, all the other classes change too.
$('.filter-group__title').on('click', function () {
$(".glyphicon").toggleClass("glyphicon-minus glyphicon-plus");
});
Upvotes: 0
Views: 83
Reputation: 1919
You should be referring the parent with "this"
$('.filter-group__title').on('click', function () {
$(this).find(".glyphicon").toggleClass("glyphicon-minus glyphicon-plus");
});
Upvotes: 1