title: Chaining parentNode calls
body: <p>Is it possible to chain parentNode (or something similar) calls?</p>
  
  <p>For example, say I have this html:</p>
  
  <pre><code>&lt;div id="mainDiv"&gt;
  
      &lt;div class="class1" id="id1"&gt;
          &lt;div class="button" id="button"&gt;&lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="class2" id="id2"&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Now let's say I have an event listener on "button". Now I want to change the id="id2" to something different, say "newId", so I call this function on "click". Is it legal to do something like this?:</p>
  
  <pre><code>function changeIdOfItem(event) {
      var event.target.parentNode.parentNode.lastChild.id = "newId";
  }
  </code></pre>
  
  <p>My logic is that the first parentNode will take you up to "id1", the second parentNode will take you up to "mainDiv", then lastChild will take you down to "id2" where you can change the id. If not this way, how would you best accomplish this with "pure" JavaScript?</p>