[jQuery] Re: Help : sort name in an where the li's a created from drag and drop.

2009-04-24 Thread mkmanning
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 wrote

[jQuery] Re: Help : sort name in an where the li's a created from drag and drop.

2009-04-24 Thread hollow
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)

[jQuery] Re: Help : sort name in an where the li's a created from drag and drop.

2009-04-24 Thread mkmanning
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 wrote: > Hi as the title says i'm looking to order a list taht is created by > drag and drop. > > the structure is a norm