(Wordpress's menu use the form

<li class="menu-item-has-children"> Item
  <ul class="sub-menu">
    <li> Sub Menu Item</li>

which means that any click event on a sub menu item is also a click on the parent item. ( It also means that any styles like background-color affect also the enclosed children but that's easy to resolve)

I want to target (in this example) $('.sub-menu') without the click event affecting the enclosing .menu-item-has-children so that I can treat a click on the outer 'Item' differently to the inner 'Sub Menu Item'.

So far I have not been able to do this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.