title: Menu supposed to hide onmouseout but it hide onmouseover
body: <p>I have a button and a menu. The button on mouse over shows the menu. I've coded when the mouse leaves the menu to hide itself, but it hides before the mouse goes over it. Help?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function showMenu() {
    var menuBar = document.getElementById("menu");
  
    menuBar.style.display = "block";
  
  }
  
  function hideMenu() {
    document.getElementById("menu").style.display = "none";
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a id="menu_button" onmouseover="showMenu()"&gt;&lt;img src="https://i.imgur.com/mRIyhW8.png" class="menu_button" onmouseover="this.src='https://i.imgur.com/zSPpoVX.png'" onmouseout="this.src='https://i.imgur.com/mRIyhW8.png'" /&gt;&lt;/a&gt;
  
  &lt;div id="menu" onmouseout="hideMenu()"&gt;
    &lt;ul&gt;
      &lt;li&gt;HOME&lt;/li&gt;
      &lt;li&gt;PORTFOLIO&lt;/li&gt;
      &lt;li&gt;ABOUT&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>EDIT</strong>
  Adding a z-index: 2; in my css solved the problem. Thank you for your time.</p>