I need to move an element one level up in dom ...
So I made :
jQuery(document).ready(function() {
jQuery('.pricing-table .fancy-header').each(function() {
jQuery(this).parent().before(this);
})
});
and Also this is ok ..
var $node = jQUery('.pricing-table .fancy-header');
jQuery($node).parent().before($node);
})
And it works great ( http://jsfiddle.net/obmerk99/EdvTz/ ) , my problem is , that on some specific page loads, I might have 2 different .fancy-header
elements and I need to move the first one UP and the second one DOWN ..
See Fiddle : http://jsfiddle.net/obmerk99/EdvTz/3/
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 and/or
efficient way of doing so than a primitive if-else
statement .
Is there such a way in jQuery ?