Is this the best way to do this?
<p>I have a navigation bar that has two dropdowns (as nested ul's). I'm trying to toggle the subnavs when its parent is clicked. Or hide one subnav when the other parent is clicked. Here's the markup:</p>

<pre><code>&lt;div id="nav-bar"&gt;
  &lt;a href="#"&gt;A link&lt;/a&gt; |
  &lt;ul&gt;
    &lt;li id="feedback"&gt;
      &lt;a href="javascript:void(0);"&gt;Feedback&lt;/a&gt;
      &lt;ul class="subnav"&gt;
        &lt;li&gt;&lt;a href="#"&gt;Give us feedback&lt;/a&gt;&lt;/li&gt;
       &lt;/ul&gt;
     &lt;/li&gt;
  &lt;/ul&gt; |
  &lt;a href="#"&gt;Another link&lt;/a&gt; |
  &lt;ul&gt;
    &lt;li id="location"&gt;
      &lt;a href="javascript:void(0);"&gt;Pick your location&lt;/a&gt;
      &lt;ul class="subnav"&gt;
        &lt;li&gt;&lt;a href="#"&gt;Los Angeles&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;New York&lt;/a&gt;&lt;/li&gt;
       &lt;/ul&gt;
     &lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</code></pre>

<p>And the code:</p>

<pre><code>//hide the subnavs and give them a little down arrow
$('ul.subnav').hide().parent().append('&lt;small&gt;&amp;#9660;&lt;/small&gt;');

// show its subnav when clicked
$('#nav-bar ul li').click(function() {
  var subnav = $(this).children('ul.subnav');
  // hide the other's subnav if it's visible
  if ($(this).attr('id') == 'location') {
    subnav.toggle();
    $('li#feedback').children('ul.subnav').hide();
  } else {
    subnav.toggle();
    $('li#location').children('ul.subnav').hide();
  }
});
</code></pre>

<p>Still a novice to JS and jQuery, I'd like to know if there's a less verbose way to accomplish what I'm trying to do above.</p>

<p>Edit: A better question is, is there a way to do this without having to explicitly give the li's an id?</p>
