I seem to be the only person to care about sort in jQuery. This ticket has a
sort function that worked with 1.1, though I'm not sure if it still does.
Make sure to scroll down to the bottom for the most recent version:

http://dev.jquery.com/ticket/255

For example, to sort the children of an element with id "foo":

$('#foo').children().sort(function(a, b) { ... }).prependTo('#foo');

You have to reinsert them into the DOM after sorting them, and 'a' and 'b'
are DOM nodes, not jQuery objects.

Hope it helps.

--Erik


On 1/14/08, monster79 <[EMAIL PROTECTED]> wrote:
>
>
> Hi all,
>
> I'm looking for an elegant method to sort elements returned from
> find() or an each() callback. Currently I'm dumping the elements' text
> into a Javascript array with push(), then sorting the array
> with .sort() and printing the results with a for() loop. This works
> well, but it doesn't seem like the jQuery way to do it. Any
> suggestions?
> Jonas
>

Reply via email to