title: Js - A more elegant / efficiant way of finding nth element in DOM than if-else
body: <p>I need to move an element one level up in dom ...</p>
  
  <p>So I made :</p>
  
  <pre><code>  jQuery(document).ready(function() {
  
    jQuery('.pricing-table .fancy-header').each(function() {
      jQuery(this).parent().before(this);
          })  
  
   });
  </code></pre>
  
  <p>and Also this is ok ..</p>
  
  <pre><code>var $node = jQUery('.pricing-table .fancy-header');
             jQuery($node).parent().before($node);
       })
  </code></pre>
  
  <p>And it works great ( <a href="http://jsfiddle.net/obmerk99/EdvTz/" rel="nofollow">http://jsfiddle.net/obmerk99/EdvTz/</a> ) , my problem is , that on some specific page loads, I might have 2 different <code>.fancy-header</code> elements and I need to move the first one UP and the second one DOWN ..</p>
  
  <p>See Fiddle : <a href="http://jsfiddle.net/obmerk99/EdvTz/3/" rel="nofollow">http://jsfiddle.net/obmerk99/EdvTz/3/</a></p>
  
  <p>Now , apart from some probable syntax mistake that makes it fail ( but that I can probably manage ) , my question is more about finding a more elegant <code>and/or</code> efficient way of doing so than a primitive <code>if-else</code> statement .</p>
  
  <p>Is there such a way in jQuery ?</p>