Alphabetically Sort Elements In Sortable List With Over 13 Items
I'm using jQuery UI to create several, interconnected sortable lists the html:
Unassigned
Solution 1:
Comparing two strings with >
returns a boolean, but sort
expects a number. Compare with localeCompare
:
listitems.sort(function (a, b) {
var ta = $(a).text().toUpperCase();
var tb = $(b).text().toUpperCase();
return ta.localeCompare(tb);
});
Post a Comment for "Alphabetically Sort Elements In Sortable List With Over 13 Items"