The following code does not work on Safari mobile:
$("#button").click(function() {
$("fieldset").each(function() {
$(this).children(".input").detach().sort(function(a, b) {
return $(a).attr("data-sort") < $(b).attr("data-sort");
}).appendTo(this);
});
});
The html looks somewhat like this:
<fieldset>
<span class='input' data-sort='3'><input>.....</input></span>
<span class='input' data-sort='1'><input>.....</input></span>
<span class='input' data-sort='2'><input>.....</input></span>
</fieldset>
It works just fine on desktop. Any ideas of what's going on?