How to move two divs upqwards in the dom using jquery? -
i not sure how this. have following code:
<div class="one">you might invite...</div> <div class="pic1"></div> <div class="name1">some name</div> <div class="pic2"></div> <div class="name2">another name</div> <div class="pic3"></div> <div class="name3">third name</div> now, want is, 1 event, want divs class pic2 , name2 jump position in code, this:
<div class="pic2"></div> <div class="name2">another name</div> <div class="one">you might invite...</div> <div class="pic1"></div> <div class="name1">some name</div> <div class="pic3"></div> <div class="name3">third name</div> how should achieved? should using "prepend"? or have recurse through dom , reposition them...
thanks
you use insertbefore()jquery api
$('.pic2').insertbefore('.one'); $('.name2').insertbefore('.one');
Comments
Post a Comment