The > says only the first instance of that object.
Hey Andy, I think I know what you meant there, but the wording might
be a little misleading. The ">" will get *all* instances of the <li>
element that are children of the preceding <ul> element. It just
won't get any <li> elements that are grandchildren (or great-
grandchildren, etc.) of the <ul>.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Mar 14, 2007, at 11:10 AM, Andy Matthews wrote:
Use the descendant selector.
Div ul li
Vs
Div ul > li
The > says only the first instance of that object.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:discuss-
[EMAIL PROTECTED] On
Behalf Of Dan Eastwell
Sent: Wednesday, March 14, 2007 10:01 AM
To: jQuery Discussion.
Subject: [jQuery] Selecting only one level in DOM and no deeper
I have a function
function closeSubModules(subModules){
for(var i=0; i < subModules.length; i++){
theElement = subModules[i];
$(theElement).hide();
}
}
one of the subModules[i] I've passed this function in an array is
"#faq li
ul" and hides all the sub-modules e.g.
<div id="faq">
<ul>
<li>
<ul> <!-- hide this -->
....
</ul>
</li>
</ul>
I've another function that toggles the hidden submodules onclick of
another
element on the page.
If the submodule has a list inside it (e.g. as bullet points within
some
text) these get hidden by closeSubModules() but don't get shown by the
toggle function (that only targets the "#faq li ul" level and no
deeper).
I've added this to my toggle function,
$(theItems).children("ul").show();
but that is a bit of a hack and only goes one level deep, and won't
show
nested lists within any text in the module.
Any thoughts?
Thanks,
Dan.
--
Daniel Eastwell
Portfolio and articles:
http://www.thoughtballoon.co.uk
Blog:
http://www.thoughtballoon.co.uk/blog
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/