On 22 Okt., 12:19, Wizzud <[EMAIL PROTECTED]> wrote: > function sortText(a, b) { > var A = $(a).text(), B = $(b).text(); > if ( A < B ) return -1; > else if ( A > B ) return 1; > return 0;} > > var tgt = $('#test') > , arr = $(tgt.find('a').get().sort(sortText)) > ; > tgt.empty().append(arr); > > arr contains your (sorted) jQuery collection of links.
I think that can be further simplified by utilizing the fact that a jQuery object is already kind of an array: [].sort.apply($(#test a), [sortText]); (untested) --Klaus