试图将其调整为按href url而不是href文本按字母顺序排列...
Javascript
function sortUsingNestedText(parent, childSelector, keySelector) {
var items = parent.children(childSelector).sort(function (a, b) {
var vA = $(keySelector, a).text();
var vB = $(keySelector, b).text();
return (vA < vB) ? -1 : (vA > vB) ? 1 : 0;
});
parent.append(items);
}
$(function () { sortUsingNestedText($('.searchresults'), "div", ".title a"); });
HTML
<div class="title"><a href="../url/thisiswhatiwantsorted/default.html">Link</a></div>