return false on parent item click event disables child anchors?

return false on parent item click event disables child anchors?

I am trying to disable the default behavior of an anchor tag with # as the href where it returns the screen to the top of the page. Typically, that's done with return false in the javascript.

In this case, I am using the following code on a parent element of a WordPress nav menu to display a submenu. It works great to stop the page from jumping, but none of the links in the sub menu work!

Is there a way to have my cake and eat it too?

Thanks!

  1. $('.menu-item-68').click( function () {
  2.         $(this).addClass('parentHighlight');
  3.         $('.menu-item-68 .sub-menu').slideToggle(300, function () {
  4.             if($(this).is(":hidden")) {
  5.                 $('.menu-item-68').removeClass('parentHighlight');
  6.             }
  7.         }).toggleClass('toggled');

  8.         return false;

  9.     });