Struggling to figure out how to loop through all ul elements with a class of ul.children and hide any child elements under ul.child that exceed 8.
See the snippet of code below for reference:
$(function() {
$('ul.children').each(function() {
var $ul = $(this);
if($ul.children().length > 8) {
$ul.hide();
}
});
});
Here is an example of how this could be applied in HTML:
<ul class="children>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>hide all other li elements below this point</li>
</ul>
<ul class="children>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>hide all other li elements below this point</li>
</ul>