I said 'something like' :) Try this:
$('#mylist ul').click(function(e){ var sorted = $.makeArray($('#mylist ul li')).sort(function(a,b){ return ($(a).text() < $(b).text()) ? -1 : 1; }); $('#mylist ul').html(sorted); }); On Apr 24, 1:46 pm, hollow <engstrom.rag...@gmail.com> wrote: > mkmanning > > Thanks for the response. > > Yes, but this doesn't give me the result > i've changed it to work on click > > but the result doesn't appear all li's disappears. > > $('#mylist ul').click(function(){ > var sorted = $.makeArray($('#mylist ul li')).sort(function(a,b){ > return $(a).text() > $(b).text(); > }); > $('#mylist ul').html(sorted); > > }); > > On Apr 24, 8:26 pm, mkmanning <michaell...@gmail.com> wrote: > > > Something like this? > > > var sorted = $.makeArray($('ul li')).sort(function(a,b){ > > return $(a).text() > $(b).text();}); > > > $('ul').html(sorted); > > > On Apr 24, 9:16 am, hollow <engstrom.rag...@gmail.com> wrote: > > > > Hi as the title says i'm looking to order a list taht is created by > > > drag and drop. > > > > the structure is a normal unordered list > > > > <ul> > > > <li>C item</li> > > > <li>E item</li> > > > <li>D item</li> > > > <li>F item</li> > > > <li>F item</li> > > > <li>A item</li> > > > </ul> > > > > Can someone help me with that please. > > > > Have looked at sort , sortable , etc... > > > But no real explanation found. > > > > Regards