<div class="courses-list container-fluid">
  <div class="courses-list-title">
    LATEST VIDEOS
  </div>
  <div class="courses-list-list row" id="latest">
  </div>
  <a class="courses-list-more" href="/app/catalog">
    More courses <i class="fa-solid fa-angle-right"></i>
  </a>
</div>

<script>
  $('.courses-for-carousel').children().each(function() {
    if ($(this).attr('carousel') == 'latest') {
      $(this).clone().appendTo($('#latest'))
    }
  })

  var $wrapper = $('#latest');
  $wrapper.children().sort(function(a, b) {
      return +a.getAttribute('latest-order') - +b.getAttribute('latest-order');
  })
  .appendTo($wrapper);
</script>