title: How can I collapse a nested list using jQuery?
body: <p>I have a nested list:</p>
  
  <pre><code>&lt;ul&gt;
    &lt;li&gt;&lt;a href='#'&gt;stuff&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href='#'&gt;stuff2&lt;/a&gt;&lt;/li&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href='#'&gt;stuff3&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;li&gt;&lt;a href='#'&gt;stuff4&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>...and want to collapse the nested ul when the li is clicked.  Before I was using</p>
  
  <pre><code>$('UL LI').click(function(){
    $(this).next().slideToggle();
  });
  </code></pre>
  
  <p>...but this obviously causes a problem when a li doesn't have a ul nested after it.  Is there a better way to do this, or is there a way for me to determine if the object returned by $(this).next() is a UL?</p>