Move the last child to the first position
My HTML:
<div id="my-slider"> <img src="/slider/pic/bf3.jpg" alt="picture"> <img src="/slider/pic/bf3_cq.jpg" alt="picture"> <!-- etc --> </div>
In the specific case, I want to move the last img tag to the first position (according to the parent)
I'm trying to:
curr.css('left', 0); curr.prepend(curr.parent());
I can change the css, but the error is raising the second line:
HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy
Can anyone give me any advice?
+6
3 answers
try http://jsfiddle.net/uttara/TFYXA/
$("#my-slider img:last-child").prependTo("#my-slider")
+3