My nav bar consists of a single UL containing LI elements that each contain a single A.
Well, most of them do. Some LI elements contain a further UL as well as the A: these "submenu" UL elements follow the same pattern of containing LI elements that each contain a single A. So far, so simple. Currently, I'm hiding all the submenu UL's on load: $('#navigation li ul').hide(); But what I want is to only hide the submenu UL's that do NOT contain an LI containing an A with a class of "selected". To rephrase: if any of the A elements (which are all inside an LI element) in that particular subnav UL, have a class of "selected", I want the UL to remain expanded. To rephrase even more: I don't want to hide the subnav containing the current page. Despite spending far too long examining the "expressions" and "traversing" documentation, I can't figure out how to build a selector statement that will encompass them. Can you help?