<script type="text/javascript">
  var sortedCourses = $("[data-course='true']").sort(function(a, b) {
    var positionA = parseInt($(a).attr("data-sort"));
    var positionB = parseInt($(b).attr("data-sort"));
    return (positionA < positionB) ? -1 : (positionA > positionB) ? 1 : 0;
  });

  $("#sorted-courses").html(sortedCourses);
</script>
