change order divs with jQuery

后端 未结 7 959
长发绾君心
长发绾君心 2020-12-08 07:44
aaa
bbb
ccc

Is poss

7条回答
  •  北海茫月
    2020-12-08 08:29

    Sounds like you want to move the first div after the last.

    $.fn.insertAfter inserts the matched elements after the parameter:

    $(".test.one").insertAfter(".test.three");
    

    http://jsfiddle.net/rP8EQ/

    Edit: If you want a more general solution of adding the first to last, without resorting to the explicit classes:

    var tests = $('.test');
    tests.first().insertAfter(tests.last());
    

提交回复
热议问题