jQuery: The Write Less, Do More JavaScript Library

How to get text content in nested list

View: New views
1 Messages — Rating Filter:   Alert me  

How to get text content in nested list

by clorentzen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm trying to get the text contents of a list item that also contains
a nested list -- but only want the text content of the parent <li>,
and not the <ul> also contained within it. Markup would look something
like:

<ul class="specialList">
   <li>The list item text
      <ul>
         <li><a href="#">Sub item one</a></li>
         <li><a href="#">Sub item two</a></li>
         <li><a href="#">Sub item three</a></li>
      </ul>
   </li>
</ul>

So what I'm trying to get jQuery to capture is "The list item text",
but nothing else in that <li>...

Is there a way to accomplish this?

Thank you!
LightInTheBox - Buy quality products at wholesale price!