Thanks Erik and Karl! I think for general code maintainability, I'll
keep my current solution with the for loop. It's much longer, but I
think overall it's easier to understand. I attached that code below in
case it would help anyone else later. However I'll be keeping an eye
on that jQuery sort
Try this bit of code that was posted by someone else a while back:
jQuery.fn.sort = function() {
return this.pushStack( jQuery.makeArray( [].sort.apply( this, arguments
) ) );
};
You can then do something like:
jqueryObject.sort( function( a, b ) {
return a - b;
});
Karl Rudd
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
3 matches
Mail list logo