I'm having trouble using the same script in two different places with another div. Below that, I need to use the same script for two different types of filters. I tried copying the script and changing the class name, but it's still not working.
View the live website here
$( document ).ready(function() {
var $btns = $('.prdsiz-filter .button-group .btn').click(function() {
if (this.id == 'all') {
$('.prosize-sec > .inner-sectn').fadeIn(450);
} else {
var $el = $('.' + this.id).fadeIn(450);
$('.prosize-sec > .inner-sectn').not($el).hide();
}
$btns.removeClass('active');
$(this).addClass('active');
});
});
$( document ).ready(function() {
var $btnsm = $('.promob-filter .mobbtn-group .btn').click(function() {
if (this.id == 'showall') {
$('.promob-sec > .mobinner-sectn').fadeIn(450);
} else {
var $elm = $('.' + this.id).fadeIn(450);
$('.promob-sec > .mobinner-sectn').not($elm).hide();
}
$btnsm.removeClass('active');
$(this).addClass('active');
});
});