load jquery after the page is fully loaded

13

I'm looking for a way to load jquery after the page is fully loaded.
well there are lots of questions and answers about it in here, but all describe how to run a script that needs jquery after either page or jquery fully loaded.
What I'm looking for is to load the page and then call jquery and after the jquery is loaded call the functions. something like:

document.onload=function(){
   var fileref=document.createElement('script');
  fileref.setAttribute("type","text/javascript");
  fileref.setAttribute("src", 'http://code.jquery.com/jquery-1.7.2.min.js');
//Here I need an event to know that jquery is 
//loaded to run stuff that needs jquery
}

This question is tagged with javascript jquery html

~ Asked on 2013-09-26 10:58:17

The Best Answer is


22

Try this:

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

~ Answered on 2013-09-26 11:44:15


8

You can also use:

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

~ Answered on 2015-04-21 07:20:15


Most Viewed Questions: