Reputation: 2031
I can't figure out which selector to use to get the items listed in a sub menu.
I want to paginate a list using Next/Prev but the sub menu won't show up. I want to show 5 items at a time, but when you hit next, you don't get the sub-list returned.
And the fiddle: http://jsfiddle.net/saltcod/bXKsZ/1/
Thanks
Upvotes: 1
Views: 2472
Reputation: 11
Use the space
char to indicate a descendant node.
$('ancestor descendant')
http://api.jquery.com/descendant-selector/
If you want a direct child node only, use >
$('parent>immediateChild')
http://api.jquery.com/child-selector/
Upvotes: 1
Reputation: 171669
This is going to hide all your sub LI's also.
$('ul li:gt(4)').hide();
Assume main UL id=list, hide only children LI's
$('#list > li:gt(4)').hide();
EDIT: same issue with next/prev . Use a parent ID to define children, not UL
since submenus also have UL
Upvotes: 1