$('.header-submenu__list ul.ul-list > li').on('click',function(){ $(this).children('.h-dropdown').addClass('active') }) $('.h-dropdown__prev').on('click',function(){ $(this).parent('.h-dropdown').removeClass('active') })
The problem is that .h-dropdown__prev is in .header-submenu__list ul.ul-list> li and when I need to remove a class, it deletes and then re-adds because the first event works again. How can you make this conflict happen?