1 2 3 $(function() { $("#test").html($("#test .slide").sort(function() { return Math.random() - 0.5; })); });