I am trying to sort a page of logos alphabetically and so have placed the logo name in a H1 tag and have used the code below, however, the logos are not being ordered properly. Can anyone see what is wrong?
var $divs = $("div.box");
$('#alphBnt').on('click', function () {
var alphabeticallyOrderedDivs = $divs.sort(function (a, b) {
return $(a).find("h1").text() > $(b).find("h1").text();
});
$("#container").html(alphabeticallyOrderedDivs);
https://jsfiddle.net/4pkrnb6v/2/
Can anyone help?