I have several buttons in a div container that need to be activated, but only one active button at a time.
EDIT:
html: div container .filter (btn, btn, btn, etc.) there are 3 button containers. The third container has a button with an identifier: # filter1-none
In the code below, there is only one button for each group.
In addition, how can I remove the active only from the button with the identifier # filter1-none ONLY if any of the other buttons is active?
$('.filter .btn').click(function () { $(this).addClass('active').siblings('.active').removeClass('active'); });
source share