title: How to detect mousein and mouseleave in pure JavaScript?
body: <p>I can't use jQuery for this part of the project due to various reasons. SO I need to detect this in vanilla js. I tried this but it doesn't work:</p>
  
  <p><a href="http://jsfiddle.net/qHfJD/" rel="noreferrer">http://jsfiddle.net/qHfJD/</a></p>
  
  <pre><code>var myDiv = document.getElementById('foo');
  
  myDiv.onmouseenter = function() { 
      alert('entered');
  }
  
  myDiv.onmouseleave = function() { 
      alert('left');
  }
  </code></pre>