Here is the whole code.

I really need to make it so that when I click on an embedded menu item, the main one becomes active. For example, when you click on a sub-item nouns, the dictionary becomes active.

I can not understand how this is done. Tell me who knows.

    1 answer 1

    As an option:

    $(document).ready(function() { $('#navi>ul>li').click(function(e) { e.preventDefault(); $('#navi li a').removeClass('active'); $(this).children('a').toggleClass('active'); }); });​ 
    • only here, inside my click after adding a class, the file is being loaded var url = $ (this) .attr ('href'); $ ('# content'). load (url); what to do with it now? - zhekonya
    • She is now not working in sub - points - zhekonya am
    • I updated the code there - zhekonya
    • one
      To be honest, the solution is devoid of elegance, but it works in your case: $ ('# navi> ul> li'). click (function (e) {e.preventDefault (); var url = $ (e.originalEvent.originalTarget) .parent () .attr ('href'); $ ('# content'). load (url); $ ('# navi li a'). removeClass ('active'); $ (this) .children ('a' ) .toggleClass ('active');}); - FLK
    • Thank! The main thing that works !!! - zhekonya