I sketched up a plugin for this.
It's at http://ff6600.org/j/jquery.dig.js
Live example at http://jsbin.com/ugena/
It just steps throught the children with the tag given and executes a
function for each one, passing it it's 'hierarchy level' in relation
to the container where the plug-in was ca
I don't think I stated my problem fully.
What I'm trying to do it process the elements recursively, so using
the 's as an example:
1. Find the shallowest 's (Karl's solutions would work here).
2. For each found:
3. Add content to the .
4. Find the next shallowest within each .
5. Recurse from
Hi Mark,
I took a look at your original post again, and from your description
there it looks like this would work:
$('ul').filter(function() {
return !$(this).parents('ul').length;
})
--Karl
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Nov 17, 2008, at 10:
The trouble is that the elements i'm looking for are not necessarily
direct children of the container,
so > isn't going to work. What I really need is to stop jQuery from
searching any deeper once it
finds the first , but continue the search at the same and
shallower levels.
Is there a way to do
That won't work. :first-child will give you *all* uls that are the
first child of any element:
...
If you need the topmost ul use the ">" combinator:
$('#container > u')
Oh, jQuery has some documentation about selectors:
http://docs.jquery.com/Select
Oops, it's actually $('#container ul:first-child')
Here's a nifty page of CSS3 selectors:
http://www.w3.org/TR/2001/CR-css3-selectors-2003/#selectors
-Hector
On Mon, Nov 10, 2008 at 5:06 PM, Hector Virgen <[EMAIL PROTECTED]> wrote:
> $('#container ul:first') should give you the first UL in
$('#container ul:first') should give you the first UL in the container
-Hector
On Mon, Nov 10, 2008 at 4:50 PM, Mark Gibson <[EMAIL PROTECTED]> wrote:
>
> Anyone know how I can find the topmost elements of a certain type, eg.
>
> Say I have several lists on a page, which in turn contain sub-
>
7 matches
Mail list logo