简体   繁体   中英

Hide parent menu and display sub menu

When a menu page is loaded hide the parent menu and display only the sub menu with checkboxes.

i have tried this but it is not hiding parent menu

          $('li').on('click', function(e) {
          $(this).children('ul').toggle();
          $(this).siblings('li').find('ul').hide();
          e.stopPropagation();
        });

try closest

 $('li').on('click', function(e) {
    $(this).children('ul').toggle();
    $(this).closest( "ul" ).hide();
    e.stopPropagation();
  });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM