$(document).ready(function () { var bool = [1, -1]; $(".listBox").html( $(".listBox>.list").sort(function (a, b) { return bool[Math.floor(Math.random() * bool.length)]; }) ); });