[jQuery] Re: Sorting links alphabetically with jQuery

2007-10-22 Thread Klaus Hartl
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().appen

[jQuery] Re: Sorting links alphabetically with jQuery

2007-10-22 Thread Wizzud
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. On Oct

[jQuery] Re: Sorting links alphabetically with jQuery

2007-10-21 Thread Yansky
Sorry to bump (and for the double post), but I was really hoping to get this working. I'm trying to sort links alphabetically by their text content. I'd really like to be able to hold on to the jQuery object element reference after sorting the links. Can anyone give me a hand? Cheers. On Oct 19,