There's nothing wrong with running that for loop yourself. In fact, it will
be faster than any other solution - because all the other solutions will
just boil down to a loop with a bunch of extra code.

-Mike

> From: nachocab
> 
> Allright, so I guess manually going through the contents() 
> array is the only solution.
> The only function that comes close to giving me the index is
> jQuery.inArray() (it's really just the for loop that I'm 
> doing with a different condition), but it doesn't let me 
> specify the id or the className, so I'm out of luck.
> 
> Thanks anyway,
> 
> Nacho
> 
> 
> 
> On Dec 30, 11:22 pm, Dave Methvin <dave.meth...@gmail.com> wrote:
> > > var $items = $('<items><item>Hello</item><item>world</item>...
> >
> > jQuery will try to parse that with the browser's HTML 
> parser, but it's 
> > not HTML. I don't know if that will cause you sorrow or not.
> >
> > 
> http://groups.google.com/group/jquery-en/browse_thread/thread/
> 95718c9...
> >
> > As for getting the index, maybe something like this?
> >
> >   $items.find('#my_item').prevAll().length
> 

Reply via email to