How to wait for loading jquery?

Good afternoon, there is a page before the closing body loaded jquery,
but before code goes here such script
$('#carousel<?php echo $module; ?>').owlCarousel({
 items: 6,
 autoPlay: 3000,
 navigation: true,
 navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>'],
 pagination: true
 });


the console swears on the presence of$ symbol - Uncaught ReferenceError: $ is not defined
it is understandable the script on jquery before the library itself is connected
so, how to adjust the code so it worked after loading jquery
so I tried - did not help
document.addEventListener('DOMContentLoaded', function () {
 $('#carousel<?php echo $module; ?>').owlCarousel({
 items: 6,
 autoPlay: 3000,
 navigation: true,
 navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>'],
 pagination: true
});
 });
March 19th 20 at 09:15
2 answers
March 19th 20 at 09:17
window.onload = function() {
...
};
March 19th 20 at 09:19
To include in the common bundle, or to insert in head tag.

Find more questions by tags jQuery