jQuery Exclusion Question
I've been using a piece of jquery code from stack overflow. Here's the link to the page:
I need to hide a large UL tree structure except the root elements. The code above works great except I can't understand the following line:
That code hides all of teh UL and LI items in the lists, but excludes the root elements. I don't understand how adding $('#lesson-sidebar ul li') as a selecond selector parameter excludes it from the hide command. I know the hide command doesn't toggle the visible state so it's not like they're hiding the root element and showing it right away. Most other descriptions rely on commands such as :not to exclude the root element.
$('ul, li', $('#lesson-sidebar ul li')).hide();
Can anyone explain why the root elements are not being hidden with that command? (Note that if I remove the $('#lesson-sidebar ul li') part the root elements are in fact hidden.