I want to utilize jQuery to show all elements within a UL that have the class .active.
Is this how my code should look?
if ($(this).hasClass('active')) {
$( ".active" ).show();
}
This is my HTML structure
<ul>
<li><a>Menu item 1</a></li>
<li class="active"><a>Menu item 2</a>
<ul>
<li><a>Menu item 2.1</a></li>
<li class="active"><a>Menu item 2.2</a>
<ul>
<li><a>Menu item 2.2.1</a></li>
<li class="active"><a>Menu item 2.2.2</a></li>
<li><a>Menu item 2.2.3</a></li>
</ul>
</li>
<li><a>Menu item 2.3</a></li>
</ul>
</li>
<li><a>Menu item 3</a></li>
</ul>
This is my CSS style
ul li ul
{
display: none;
overflow: hidden;
}