Use the “wp_nav_menu” filter to change the href attribute to a hash # which would normally reload the same page. You would also add an “onclick” javascript function call. The function would first cancel the default action, then change the CSS of the submenu. If the display property is none, change it to block. If it’s block, change it to none. Thus one can toggle the display on or off by repeatedly clicking the main menu item.
A nice enhancement would be to capture some keyboard events. If the menu item has focus and enter is pressed, toggle the submenu. If the submenu is displayed and escape is pressed, hide it.
]]>