Show menu if child has an active class

Show menu if child has an active class

Hi, i'm using the following code to hide any sub menus:

$('ul ul').hide();

But i also need to show any sub menus which has an li tag inside with an active class. eg

<ul>
  <li>Top 1
    <ul>
      <li class="active">Sub 1</li>
      <li>Sub 2</li>
    </ul>
  </li>
  <li>Top 2
    <ul>
      <li>Sub 1</li>
      <li>Sub 2</li>     
    </li>
  </li>
</ul>


Because sub 1 of top 1 is active sub 1 and 2 of top 1 would appear but sub 1 and 2 of top 2 would not.

Appreciate if you could help.

Thanks