How to tell that a submenu has been selected rather than the top menu

How to tell that a submenu has been selected rather than the top menu

I need to determine that the user has selected a sub-menu item rather than the top level item, and I'm having real trouble in determining that within the select event.

I tried

  1. if ( ui.item.children('ul').length === 0)

But the problem I have is that if the user clicks on the top level menu and then clicks on it again, it triggers the event, and subsequently using:

  1. ui.item.context.textContent

contains all the sub-menu items.

    • Topic Participants

    • garyp