title: jQuery: change the order of two rows of a table
body: <p>I want to change the order of two rows in a table.</p>
  
  <p>I have this code:</p>
  
  <pre><code>console.log(position.parent().parent().prev());
  console.log(position.parent().parent());
  //I expected this line do the work, but no...
  $(this).parent().parent().prev().insertAfter($(this).parent().parent());
  </code></pre>
  
  <p>That is printing this:</p>
  
  <pre><code>&lt;tr&gt;​
  &lt;td&gt;​Element 1​&lt;/td&gt;​
  &lt;td&gt;​…​&lt;/td&gt;​
  &lt;td&gt;​2008-02-02​&lt;/td&gt;​
  &lt;td class=​"jander" data-pos=​"0" data-category=​"1"&gt;​…​&lt;/td&gt;​
  &lt;/tr&gt;​
  
  &lt;tr&gt;​
  &lt;td&gt;​Element 2​&lt;/td&gt;​
  &lt;td&gt;​…​&lt;/td&gt;​
  &lt;td&gt;​2007-02-02​&lt;/td&gt;​
  &lt;td class=​"jander" data-pos=​"1" data-category=​"1"&gt;​…​&lt;/td&gt;​
  &lt;/tr&gt;​
  </code></pre>
  
  <p>Any idea?</p>
  
  <p>Regards</p>
  
  <p>Javi</p>