Consider a dynamic dropdown-menu. Because of creating this code server side I don’t know the exact number of li situated in div 'sub'.Example HTML output:
<li>
<a href="#">Videos</a>
<div id="sub">
<ul>
<li><a href="#">Main</a></li>
<li><a href="#">Acting</a></li>
<li><a href="#">Animals</a></li>
</ul>
</div>
</li>
The following script should give the number of li in the in div id="sub"
$(function() {
$('.tabMenu li a').click(function() {
currentLink = $(this);
//Get number of children elements
alert(currentLink.children().size());
});
Any help will be greatly appreciated.
1 Answer