Your code:
$('.parent li').click(function(){ event.preventDefault(); $('.child').slideToggle('slow'); });
$('.child') selects all the "children". Change it to $('.child', this) to select only those that are inside the current element.
click event templates, therefore, to ensure that only clicking on the parent element itself switches state, you can compare event.target with this .
However, this is faster:
$('.parent > li > a').click(function(){ event.preventDefault(); $(this).parent().find('.child').slideToggle('slow'); });
See fiddle
EDIT , as @Jasper pointed out, this will be shorter / faster:
$('.parent > li > a').click(function(){ event.preventDefault(); $(this).siblings('.child').slideToggle('slow'); });
source share