You don't need JavaScript / jQuery to show a hidden (display: none) child/nested ul on hover of the parent li, as this can be achieved with CSS alone:-
This is a basic implementation and to ensure you target the right element you should use a CSS ID or Class like so:-[css]li.top:hover > ul.sub { display: block;}[/css]This method is particularly useful for creating Menus with nested Submenus (at multiple levels) that are to be displayed on hover. The limitation of this approach is that there is no specific CSS declaration for an 'onClick' event (:focus is the closest / :target for links) and for this, you would need JavaScript.
Join in the Discussion