title: Is my code to change the CSS of an element when clicked efficient?
body: <p>I want to know if there is a more efficient way to change the CSS of multiple elements when one is clicked.</p>
  
  <p>I have working code whereby clicking on a subheading within the "About" section changes its color, the color of the other subheadings, and the opacity of reach respective paragraph. It looks like a lot of code to me. I imagine there is a simpler or at least more streamlined way to accomplish these things that I just don't know with my borderline intermediate JS skills.</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>const about = () =&gt; {
    const paraOne = document.getElementById("para-one");
    const paraTwo = document.getElementById("para-two");
    const paraThree = document.getElementById("para-three");
    const mission = document.querySelector(".mission");
    const value = document.querySelector(".value");
    const vision = document.querySelector(".vision");
    mission.addEventListener('click', () =&gt; {
      mission.classList.add("active");
      value.classList.remove("active");
      vision.classList.remove("active");
      paraOne.classList.remove('zero');
      paraTwo.classList.add('zero');
      paraThree.classList.add('zero');
    });
    value.addEventListener('click', () =&gt; {
      value.classList.add("active");
      mission.classList.remove("active");
      vision.classList.remove("active");
      paraOne.classList.add('zero');
      paraTwo.classList.remove('zero');
      paraThree.classList.add('zero');
    });
    vision.addEventListener('click', () =&gt; {
      vision.classList.add("active");
      mission.classList.remove("active");
      value.classList.remove("active");
      paraOne.classList.add('zero');
      paraTwo.classList.add('zero');
      paraThree.classList.remove('zero');
    });
  }
  
  about();</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#about-center ul li:hover,
  #about-center ul li.active {
    color: black;
    cursor: pointer;
  }
  
  .active {
    color: black;
    cursor: pointer;
  }
  
  #container {
    position: relative;
  }
  
  #container p {
    position: absolute;
    left: 30%;
  }
  
  .zero {
    opacity: 0;
  }
  
  #about ul,
  #about p,
  #about button {
    margin-bottom: 2em;
  }
  
  #about-center p {
    font-size: 2rem;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="about-center"&gt;
    &lt;h1&gt;About Us&lt;/h1&gt;
    &lt;ul&gt;
      &lt;li class="mission active"&gt;OUR MISSION&lt;/li&gt;
      &lt;li class="value"&gt;our values&lt;/li&gt;
      &lt;li class="vision"&gt;our vision&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div id="container"&gt;
      &lt;p id="para-one"&gt;This is our mission.
      &lt;/p&gt;
      &lt;p id="para-two" class="zero"&gt;These are our values.
      &lt;/p&gt;
      &lt;p id="para-three" class="zero"&gt;This is our vision.
      &lt;/p&gt;
    &lt;/div&gt;
    &lt;button&gt;read more&lt;/button&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>