load jquery after the page is fully loaded

You can also use:

$(window).bind("load", function() { 
    // Your code here.
});

For your problem, the solution might be to attach CDN hosted by google with certain library:

https://developers.google.com/speed/libraries/devguide

Also, you can add this at the bottom of page (just before </body>):

<script type="text/javascript">
(function() {
    var script = document.createElement('script')
    script.setAttribute("type", "text/javascript")
    script.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js")
    document.getElementsByTagName("head")[0].appendChild(script)
})();
</script>

However, this is risky in my opinion. You have an asynchronous call for jquery, thus your jquery has to wait until it loads (ie. $(document).ready won't work in this case). So my answer would be: use a CDN like google suggests; put your javascript on the bottom just before </body>; and, ignore flags from profilers.


Try this:

 $(document).ready(function() {
// When the document is ready
// Do something  
});