count deepness

count deepness

Hello,

I have created a menu with ul en li elements, like this:

<ul>
  <li>a</li>
  <li>a</li>
  <li>a
  <ul>
    <li>a</li>
    <li>a</li>
    <li>a</li>
  </ul>
  </li>
  <li>a</li>
</ul>


now i want to calculate how far i can go in this submenu, in this example the farest i can get is 2. Becouse i start in the menu wich is number 1 and then i can go 1 submenu deeper, so thats 2.

Now my question how can i calculate this using jquery.

Thanks in any advance.