How do I select all of the elements in a list that have children, using jQuery?

Posted by Travis on Stack Overflow See other posts from Stack Overflow or by Travis
Published on 2010-05-29T13:34:32Z Indexed on 2010/05/29 13:42 UTC
Read the original article Hit count: 187

I have an arbitrarily deep list, like so:

<ul>
<li></li>
<li>
  <ul>
    <li></li>
    <li>
      <ul>
        <li></li>
        <li></li>
      </ul>
    </li>
  </ul>
</li>

Using jQuery, how can I select every li in the list that is not a leaf node. In other words, I want to select all of the li elements that have children ULs.

Thanks for your help!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery