I am getting a "$ is undefined" error on $(document).ready() after changing jQuery script loading to async.
Following is the short version of my code. It was working before I added the async attribute to my <script> tag that loads jQuery.
I did this based on the recommendation provided by Google Page Insight to improve my page's performance
<script src="/scripts/jquery.min.js" async></script>
<script>
$(document).ready(function(){
//Some variable initialization
});
</script>
asyncmeans. You wantdeferinstead – that does preserve and guarantee execution order.