title: Cannot remove class in div from within, JS
body: <p>As you can see I would like to remove <code>extended</code> class from a parent div. For some reason that does not work. How can I make it to work?</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>function closeExpandedProject() {
    const expandedElement = document.querySelector('.expanded');
    expandedElement.classList.remove('expanded');
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.expanded { border: 1px solid black; }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="project-item-wrapper expanded"&gt;
    Here is some text
    &lt;span class="close" onclick="closeExpandedProject()"&gt;X&lt;/span&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>