title: Remove class from parent element javascript
body: <p>I have a container that opens via an onclick function. I then have a cross within the container that should close the parent element however I receive a</p>
  <pre><code>TypeError: undefined is not an object (evaluating 'parent.id')
  </code></pre>
  <p>Code is here</p>
  <pre><code>&lt;div class=&quot;post&quot; onclick=&quot;postClick(el)&quot;&gt;
  ...
  ...
  &lt;/div&gt;
  </code></pre>
  <p>JavaScript</p>
  <pre><code>             function postClick(el) {
                       document.getElementById(el.id).classList.add(&quot;read&quot;);
               }
               function postClose(event) {
                   var parent = this.parentNode;
                   console.log(parent.id);
                   parent.id.classList.remove(&quot;read&quot;);         
               }
  </code></pre>