_IF_ you only have text in your LIs then... $('li').each(function(){ alert($(this).html().match(/^([^<]*)/)[0]); });
On Nov 2, 5:35 pm, "Jonathan Sharp" <[EMAIL PROTECTED]> wrote: > I'm sure there's a more elegant solution but you could do something like: > > // Untested > var about = $( 'selector for the li' ).clone().find('> > ul').remove().end().html(); > > Cheers, > -Jonathan > > On 11/2/07, sawmac <[EMAIL PROTECTED]> wrote: > > > > > I'm trying to select text inside list items. I'm using > > jQuery's .text( ) method. Unfortunately, that returns the text of all > > children as well. That means for a nested list like this > > > <ul> > > <li>index.html</li> > > <li>about > > <ul> > > <li>index.html</li> > > <li>more.html</li> > > </ul> > > </li> > > </ul> > > > $('li').eq(1).text() returns > > 'about > > index.html > > more.html' > > > I just want to retrieve "about" not the text from the child list > > items. Any ideas on how to do that? > > > thanks