Hey guys,
I have a piece of JS that I know has a cleaner setup than what I have below. I tried adding sub-cat-button
as another var to buttons but I couldn’t make it work (beginner coder).
Thanks for the help!
$(function() {
var buttons = $('.cat-button');
buttons.click(function(e) {
e.preventDefault();
buttons.removeClass('focus');
$(this).addClass('focus');
});
});
$(function() {
var buttons = $('.sub-cat-button');
buttons.click(function(e) {
e.preventDefault();
buttons.removeClass('focus');
$(this).addClass('focus');
});
});