There is a drop down menu on jQuery. I want to make it so that when you click on the link the menu still closes, and does not remain open. How to be? Here are the attempts:

$(document).ready(function() { $('.humb').click(function(){ $('.nav').toggleClass('active'); }); if ( $('.nav').hasClass('active')) { $('ul li a').click(function() { $('.nav').removeClass('active'); }); }; 

    1 answer 1

      $(document).ready(function() { $('.humb').click(function(){ $('.nav').toggleClass('active'); }); $('ul li a').click(function() { if ( $('.nav').hasClass('active')) { $('.nav').removeClass('active'); } }) }); 
    • Thank you very much - Vladyslav Tereshyn