title: Mouse Listeners and select option in JavaScript. mouseover eventListener does not work with <option> of <select> selector in pure JS
body: <p>I'm trying to make a personalized <code>:hover</code> for <code>&lt;option&gt;</code> elements in <code>&lt;select&gt;</code> selector by <code>mouseover</code> eventListener. But for some reasons <code>mouseover</code> does not fired when the mouse has been on the <code>option</code> element.</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>    var selectOne = document.querySelector('.select__first');
      var selectTwo = document.querySelector('.select__second');
  
      for (var key in selectOne) {
        if (key % 2 == 0)
          selectOne[key].classList.add('select__option-blue');
      }
  
      for (var key in selectTwo) {
        if (key % 2 == 0)
          selectTwo[key].classList.add('select__option-blue');
      }
   
      function onMouseOver(e) {
  
        var target = event.target;
  
        var options = event.target.closest('option');
        if (!options) return;
        console.log(options);
      }
  
      document.addEventListener( 'mouseover', onMouseOver);</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>    .select__element &gt; p, span {
        display: inline-block;
      }
  
      .select {
          -webkit-appearance: listbox;
          cursor:  pointer;
      }
  
      .select__option-blue {
        background-color: lightblue;
      }
  
      option {
        cursor:  pointer;
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;style type="text/css"&gt;
  
  
  
    &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
   &lt;div class="select-row"&gt;
      &lt;div class="select__element"&gt;
        &lt;p&gt;The last element: &lt;/p&gt;&lt;span class="select__element-last"&gt;&lt;/span&gt;
      &lt;/div&gt;
      &lt;select class="select select__first"&gt;
        &lt;option value="birds" hidden&gt;Select an element...&lt;/option&gt;
        &lt;option value="birds"&gt;One&lt;/option&gt;
        &lt;option value="fishes"&gt;Two&lt;/option&gt;
        &lt;option value="animals"&gt;Three&lt;/option&gt;
        &lt;option value="dino"&gt;Four&lt;/option&gt;
        &lt;option value="simplest"&gt;Five&lt;/option&gt;
      &lt;/select&gt;
  
      &lt;select class="select select__second"&gt;
        &lt;option value="birds" hidden&gt;Select an element...&lt;/option&gt;
        &lt;option value="ploto"&gt;One&lt;/option&gt;
        &lt;option value="trava"&gt;Two&lt;/option&gt;
        &lt;option value="vseyad"&gt;Three&lt;/option&gt;
      &lt;/select&gt;
    &lt;/div&gt;
  
    &lt;script&gt;
  
  
  
    &lt;/script&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>