Hello all,

I've been using jQuery for a month or so now and am really enjoying it!

I haven't been able to figure out how to sort a collection of elements. I have something like the following:

<div class="entry"><span class="foo">foo1</span><span class="bar">bar1</span></div
<div class="entry"><span class="foo">foo2</span><span class="bar">bar2</span></div

I would like to be able to do something like:

$('.entry').sort(function(a, b) { return $('.foo', a).text()-$('.foo', b).text(); }).appendTo('#sortedStuff');

Or something like that. I know _javascript_ has a sort function, but that's for arrays, so I'm not sure how that will work with jQuery? Also, a google search for 'jquery sort' (no quotes), brings up some stuff about sorting in the jQuery code, but it appears old and I can't find anything about sorting in the latest release.

Lastly, jQarray.js seems like it would do what I want, but it appears that site is gone (taking jXs with it, btw). It would be nice if plugins were cached on the jQuery site. Anybody have jQarray/jXs?

Thanks,
Erik
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to