move up/down in jquery

前端 未结 3 1735
醉酒成梦
醉酒成梦 2021-01-07 08:49

I Have 5 spans i am trying to move them up/down (swap positions) in jquery

Up! 
Down!         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-07 09:39

    That's because you're telling a span to go before the next span (i.e., stay the same). Try using insertBefore on a previous or insertAfter with a next.

    EDIT Try this on for size: http://jsfiddle.net/eJk3R/

提交回复
热议问题