How to switch dropdown and hide on re-pressing?

https://jsfiddle.net/kts1hzw4/
You need to by clicking on another button open here calls a dropdown disappeared and opened up new, and re-pressing the same button outdoor here calls a dropdown was hidden.
March 23rd 20 at 19:01
1 answer
March 23rd 20 at 19:03
Solution
$(document).on('click', function(e) {
 const $target = $(e.target);

$target
.closest('.p-filter__link').toggleClass('active')
.closest('.p-filter__item')
.find('.p-filter__submenu').fadeToggle();

$('.p-filter__submenu')
.not($target.closest('.p-filter__item').find('.p-filter__submenu')).fadeOut()
.closest('.p-filter__item')
.find('.p-filter__link').removeClass('active');
});
Thank you so much! - Holden_Sanfo commented on March 23rd 20 at 19:06

Find more questions by tags jQuery