title: add a class to an element after being clicked
body: <p>I'm trying to add a class to an element after an event listener detects a click of said element, I've used the following code, but it's not specific and any element being clicked will receive the class.</p>
  <pre><code>document.addEventListener('click', (event) =&gt; {
     event.target.classList.add(&quot;selected&quot;);
  });
  </code></pre>
  <p>what I thought would work was this:</p>
  <pre><code>var element = document.getElementById(&quot;object1&quot;);
  document.element.addEventListener('click', (event) =&gt; {
     element.classList.add(&quot;selected&quot;);
  });
  </code></pre>
  <p>Is there anything else I can use?</p>