title: How To open Sub Menu with onclick Function and hide with onclick Function
body: <p>I made a sidebar nav I did this so on mouseover opens sub menu but I want it on click to open and onclick on same tab to hide it. Please check my code in this codepen Thanks.</p>
  
  <pre><code>&lt;nav class="navigation"&gt;
    &lt;ul class="mainmenu"&gt;
      &lt;li&gt;&lt;a href=""&gt;Home&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=""&gt;About&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=""&gt;Products&lt;/a&gt;
        &lt;ul class="submenu"&gt;
          &lt;li&gt;&lt;a href=""&gt;Tops&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=""&gt;Bottoms&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=""&gt;Footwear&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
        &lt;li&gt;&lt;a href=""&gt;Contact us&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p><a href="https://codepen.io/anon/pen/erNpYG" rel="nofollow noreferrer">https://codepen.io/anon/pen/erNpYG</a></p>
  
  <p>Thanks In Advance.</p>