JS/JQuery: I'm trying to move an li node under the one it matches
<pre><code>$(document).ready(function() {
var a = $("li.comment").attr("id");
var b = $("li.comment[id='"+a+"']");
var c = $("li.comment &gt; div.comment-body div &gt; p &gt; a").attr("href");
var d = $("li.comment &gt; div.comment-body div &gt; p &gt; a[href='"+c+"']");
var e = new RegExp("[#+'+b+']b")

if (d===e) {
  d.parent().append(a);};
};)
</code></pre>

<p>If <code>d</code> matches <code>b</code>, I'm trying to move <code>d</code> (starting from the <code>li</code> node) to right under <code>b</code> who's id it matches. I can't figure it out. </p>

<p>Sample:</p>

<pre><code>&lt;li id="wow" class="comment"&gt;
&lt;div class="comment-body"&gt;
&lt;div&gt;
&lt;p&gt;Any comments?&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li id="rebble" class="comment"&gt;&lt;div class="comment-body"&gt;&lt;div&gt;&lt;p&gt;Wakatow&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class="comment" id="det"&gt;
&lt;div class="comment-body"&gt;
&lt;div&gt;
&lt;p&gt;
&lt;a href="#wow"&gt;Yeah! Hold on a sec...&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
</code></pre>

<p>I'm trying to work it out on jsfiddle, but I can't get it done. When it comes out right, the <code>li</code> with the link is supposed to move under the first one</p>
