How to sort divs according to their id using jQuery?

前端 未结 3 905
太阳男子
太阳男子 2020-12-01 19:31

I have a set of divs with random ids:

3条回答
  •  没有蜡笔的小新
    2020-12-01 20:12

    Try my jquery plugin $.toArrayouter, using Underscore library.

    $('#container').html(_.sortBy($('#container>div').toArrayouter(),function (name) {return name} ).join(''))
    

    Demo : http://jsfiddle.net/abdennour/fDZjR/1/

提交回复
热议问题