Hi I want to count LI which does not have the UL , for the first level only,
but when I count this it shows size 4 instead of 2, its count the inner LI also.
<div class="navigation-container">
<ul class="first-level">
<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>
jQuery for this.
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);
});
Link for the testing link text on JSBin,
thanks