Insert line after div's grandparent
<p><code>this</code> corresponds to a specific div.</p>

<p>I would like to insert a piece of code after its grandparent using this code but it doesn't seem to work: <code>this.parentNode[0].parentNode[0].insertAfter(newrespondform);</code></p>

<p>I can provide more code if needed but after trying to debug I'm pretty ure the problem lie in here.
How could I write it so that it works? I cannot add an ID to the grandparent to select it that way.</p>

<p>Thanks for your aid :)</p>

<p>EDIT - here is the entire code that gets loaded on page load:</p>

<pre><code>function comrespond(){
    function addresform(){
    var resid = this.getAttribute('id'),
    grandParent = this.parentNode.parentNode,
    newrespondform = '&lt;div class="commentresponse"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;p class="author"&gt;Leave a reply:&lt;/p&gt;&lt;form id="commentform" action="http://split.snippetspace.com/wp-comments-post.php" method="post" onsubmit="addcomment(); return false;"&gt;&lt;input id="author" aria-required="true" name="author" type="text" placeholder="Your name"/&gt;&lt;input id="email" aria-required="true" name="email" type="text" placeholder="Email address" /&gt;&lt;textarea id="comment" aria-required="true" name="comment" rows="8"&gt;&lt;/textarea&gt;&lt;input id="submit" name="submit" type="submit" value="Post Comment" /&gt;&lt;input id="comment_post_ID" name="comment_post_ID" type="hidden" value="'+resid+'" /&gt;&lt;/form&gt;&lt;/span&gt;&lt;/div&gt;';
    grandParent.parentNode.insertBefore(newrespondform, grandParent.nextSibling);
    }
    var responsebtn = document.getElementsByClassName('comment-reply-link');
    for(var i = 0; i &lt; responsebtn.length; i++){
                    bindEvt(responsebtn[i], "click", addresform);
                };}
</code></pre>

<p>the HTML:</p>

<pre><code>&lt;div&gt;
    &lt;span&gt;&lt;/span&gt;
    &lt;span&gt;
        &lt;p class="author"&gt;Christopher&lt;/p&gt;
        &lt;div class="comment-reply-link" id="106"&gt;&lt;/div&gt;
        &lt;p&gt;test comment 2 to see if it increments!&lt;/p&gt;
    &lt;/span&gt;
&lt;/div&gt;
</code></pre>
