title: Sidebar menu doesn't collapse on click
body: <p>The sidebar menu show up when a user clicks on the vertical black border on the left but it is not collapsing when i click on the close button. I want it to close with the same animation with javascript or jquery.</p>
  
  <pre><code>&lt;div id="mySidenav" class="sidenav" onclick="openNav()" style="cursor: pointer;"&gt;
    &lt;a href="javascript:void(0)" class="closebtn" onclick="closeNav()"&gt;&amp;times;&lt;/a&gt;
    &lt;a href="#"&gt;About&lt;/a&gt;
    &lt;a href="#"&gt;Services&lt;/a&gt;
    &lt;a href="#"&gt;Clients&lt;/a&gt;
    &lt;a href="#"&gt;Contact&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;h2&gt;Animated Sidenav&lt;/h2&gt;
  
  &lt;script&gt;
  function openNav() {
    document.getElementById("mySidenav").style.width = "250px";
  }
  
  function closeNav() {
    document.getElementById("mySidenav").style.width = "0";
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Demo <a href="https://jsfiddle.net/1n6bajmh/" rel="nofollow noreferrer">https://jsfiddle.net/1n6bajmh/</a></p>