[jQuery] Best way to find current position in DOM stack?

[jQuery] Best way to find current position in DOM stack?

Might want to be careful with that last suggestion, and be sure to specify the specific <ul> in question in case there are other <li> on the page.
i.e. $("ul#theid li")
though i am just learning jquery and am not sure if that is the correct syntax to select the <li> in a particular <ul> by id.
----- Original Message ----
From: John Resig <jeresig@gmail.com>
To: jQuery Discussion <discuss@jquery.com>
Sent: Friday, March 23, 2007 12:40:52 PM
Subject: Re: [jQuery] Best way to find current position in DOM stack?
You want the index() function:
var item = $("li.selected")[0];
var position = $("li").index( item );