How to select LI except first and second ?

Posted by Wazdesign on Stack Overflow See other posts from Stack Overflow or by Wazdesign
Published on 2010-05-05T12:30:44Z Indexed on 2010/05/05 15:28 UTC
Read the original article Hit count: 331

Filed under:
|
|

Here is the structure of the content, I want to select all LI except the first two (ie no-link)

jQuery(document).ready(function(){

  var nosubnav = jQuery('.first-level li:not(:has(ul))');
  var nosubnavsize = jQuery('.first-level li:not(:has(ul))').size();
  jQuery(nosubnav).css('border' , '1px solid red');
  alert('List item which does not have submenu  '+nosubnavsize);

});

div class="navigation-container">
    <ul class="first-level">
    <li><a href="#">No Link</a></li>
    <li><a href="#">No Link</a></li>
      <li><a href="#">Link 1</a></li>
      <li><a href="#">Link 2</a>
        <ul>
          <li><a href="#">Link2.1</a></li>
          <li><a href="#">Link2.2</a>
            <ul>
                <li><a href="#">Link 2.2.1</a></li>
            </ul>
          </li>
        </ul>
      </li>
      <li><a href="#">Link </a></li>
    </ul>  
  </div>

related Question : http://stackoverflow.com/questions/2771801/how-to-count-li-which-does-not-have-ul

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html