title: How do I find out which list item was selected?
body: <p>I am trying to find out which exact list item was selected in the navigation menu. With this information, I will remove the class <code>active</code> from the previous menu link and add it to the newly selected one.</p>
  
  <pre><code>&lt;ul class="nav navbar-nav navbar-right"&gt;
        &lt;li class="active"&gt;&lt;a href="#pageOne"&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#pageTwo"&gt;About&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>let menuClick = document.getElementsByClassName(".nav");
  menuClick.addEventListener('click', changeActive(), false);
  
  function changeActive(){
       //enter code here
  }
  </code></pre>