title: Javascript Drop Down Menu not working
body: <p>I am trying to make a drop down menu with Javascript (no JQuery). In my HTML, I have an unordered list that contains two list items, each containing an anchor and an unordered list with more list items inside.</p>
  
  <p>I am not concerned about the menus looking pretty, just that the Javascript works. Right now, I am trying to get it to set up event listeners through a 
  while loop so that when the top level list items are moused over, the class of the lower list itemsnwill change from one in which the CSS is set to display:none; to a class that has display:block; to make them appear.</p>
  
  <p>I only have two tabs here, but that is because I shortened it from a list of ten tabs. I also don't care about any further submenus.</p>
  
  <p>JS Fiddle: <a href="https://jsfiddle.net/xL5pukd5/" rel="nofollow">https://jsfiddle.net/xL5pukd5/</a></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;header&gt;
    &lt;!-- &lt;ul&gt;   &lt;li&gt;&lt;a&gt;&lt;/a&gt;&lt;ul&gt;   &lt;li&gt;&lt;a&gt;&lt;/a&gt;&lt;/li&gt;   --&gt;
    &lt;!-- dd-menu dd-menu-tab dd-menu-tab-anchor dd-submenu dd-submenu-tab dd-submenu-tab-anchor --&gt;
    &lt;nav id="dd-menu-container"&gt;
      &lt;ul id="dd-menu"&gt;
        &lt;li class="dd-menu-tab"&gt;
          &lt;a href="link1.htm" class="dd-menu-tab-anchor" title="Link1"&gt;Link 1&lt;/a&gt;
          &lt;ul class="dd-submenu"&gt;
            &lt;li class="dd-submenu-tab"&gt;
              &lt;a href="#" class="dd-submenu-tab-anchor"&gt;SubLink1a&lt;/a&gt;&lt;/li&gt;
            &lt;li class="dd-submenu-tab"&gt;
              &lt;a href="#" class="dd-submenu-tab-anchor"&gt;Sublink1b&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li class="dd-menu-tab"&gt;
          &lt;a href="link2.htm" class="dd-menu-tab-anchor" title="link2"&gt;Link2&lt;/a&gt;
          &lt;ul class="dd-submenu"&gt;
            &lt;li class="dd-submenu-tab"&gt;
              &lt;a href="#" class="dd-submenu-tab-anchor"&gt;Sublimn2a&lt;/a&gt;&lt;/li&gt;
            &lt;li class="dd-submenu-tab"&gt;
              &lt;a href="#" class="dd-submenu-tab-anchor"&gt;Sublink2b&lt;/a&gt;&lt;/li&gt;
            &lt;li class="dd-submenu-tab"&gt;
              &lt;a href="#" class="dd-submenu-tab-anchor"&gt;Sublink2c&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
        &lt;/li&gt;
  
    &lt;/nav&gt;
  
  &lt;/header&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>getTabs = function(elementClass) {
    var tabs = document.getElementsByClassName(elementClass);
    return tabs
  };
  getSubmenus = function(elementClass) {
    var submenus = document.getElemenetsByClassName(elementClass);
    return submenus;
  };
  
  window.onload = function {
    var tabs = getTabs("dd-menu-tab");
    var submenus = getSubmenus("dd-submenu");
    var tabNumber = tabs.length - 1;
    var currentTab = 0;
    while (currentTab &lt;= tabNumber) {
      tabs[currentTab].onmouseover = function {
        submenus[currentTab].className = "dd-submenu-onmouseover"
      };
      tabs[currentTab].onmouseout = function {
        submenus[curenetTab].className = "dd-submenu"
      };
      currentTab += 1;
    }
  };
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>.dd-submenu {
    display: none;
  }
  
  .dd-submenu-onmouseover {
    display: block;
  }
  </code></pre>
  
  <p>I've tried using other prewritten drop down menu methods, but I couldn't get them to work, so I tried to create my own. Thanks in advance to any help :)</p>