<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body> <script> var waitForJQuery = setInterval(function () { if (typeof $ != 'undefined') { // put in the actual custom code here console.log('jQuery Loaded'); clearInterval(waitForJQuery); } else{ console.log('waiting for jQuery - setInterval 10ms'); } }, 10); </script> <script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script> <script> $(document).ready(function() { /* code here */ console.log('document.ready ' + Date.now()); }); $(function() { /* code here */ console.log('function() ' + Date.now()); }); </script> </body> </html>