Target an ull element with class="menus" excluding the others, only one at a time [closed]

2
jQuery(document).ready(function() {
  $('.heading-list').bind('click',function(){
    $('.list').children().css({ 'display': 'block' });

  })


   $('.heading-list').bind('dblclick',function(){
    $('.list').children().css({ 'display': 'none' });      

   })  
});

I want when I click on the title, only the child list of that title and the other lists are not called tbm to explain better: link

    
asked by anonymous 18.08.2017 / 17:16

1 answer

1

You can use $(this).next('.list') to find the right element.

jQuery(document).ready(function() {
  $('.heading-list').on('click', function() {
    $(this).next('.list').children().toggle();
  });
});

Example: jsFiddle

    
18.08.2017 / 17:54