title: Jquery - Slide Menu (HandMade)
body: <p>How are you people?, im doing a script for a slidemenu using ul/li(ul/li), the idea is to be using slideup/down without inner classes</p>
  
  <p>The trouble i have is when click in a link inside my ul (father) li (son) ul li a the son´s  ul (ul li ul) get hide. The idea it´s just to make that if you click in the ul li a, not in the ul li ul li a. I tried with ":first", ".first()", ":first-child".</p>
  
  <p>Hope could make myself clear. :D</p>
  
  <p>here´s the code:</p>
  
  <p>HTML</p>
  
  <pre><code>    &lt;ul id="menu"&gt; 
         &lt;li&gt; 
             &lt;a href="#"&gt;Menu 1&lt;/a&gt; 
             &lt;ul&gt; 
                  &lt;li&gt;&lt;a href="#"&gt;Sub Menu 1&lt;/a&gt;&lt;/li&gt; 
                  &lt;li&gt;&lt;a href="#"&gt;Sub Menu 2&lt;/a&gt;&lt;/li&gt; 
                  &lt;li&gt;&lt;a href="#"&gt;Sub Menu 3&lt;/a&gt;&lt;/li&gt; 
              &lt;/ul&gt; 
          &lt;/li&gt; 
          &lt;li&gt; 
             &lt;a href="#"&gt;Menu 2&lt;/a&gt; 
             &lt;ul&gt; 
                  &lt;li&gt;&lt;a href="#"&gt;Sub Menu 1&lt;/a&gt;&lt;/li&gt; 
                  &lt;li&gt;&lt;a href="#"&gt;Sub Menu 2&lt;/a&gt;&lt;/li&gt; 
                  &lt;li&gt;&lt;a href="#"&gt;Sub Menu 3&lt;/a&gt;&lt;/li&gt; 
              &lt;/ul&gt; 
          &lt;/li&gt; 
          &lt;li&gt;&lt;a href="#"&gt;Menu 3&lt;/a&gt;&lt;/li&gt; 
      &lt;/ul&gt; 
  </code></pre>
  
  <p>Javascript (Jquery)</p>
  
  <pre><code>    function submenu(id) { 
         var div = "#"+id; 
         $("ul"+div+" li a").each(function () { 
            $(this).click(function() { 
               var li = $(this).parent();       
               $("ul"+div+" li ul").each(function () {   $(this).slideUp("fast");   }); 
               if(li.children("ul").is(":visible")) {  
                  li.children("ul").slideUp("fast"); 
               } else {  
                  li.children("ul").slideDown("fast");  
               } 
               return false; 
            }); 
         }); 
      } 
  
      $(document).ready(function(){   submenu("menu");   } 
  </code></pre>
  
  <p>Thanks</p>