$(window).load Is Deprecated

For years, I had been using jQuery’s nifty $(window).load handler to do stuff once a page’s scripts, images, etc. finished loading. And then, one day, I went to copy/paste from the .load() documentation and saw a note that it had been deprecated. Oh no!

No need to panic. There’s an easy solution. Instead of this old code:

Use this instead:

It does the same exact thing, only it’ll still work once you upgrade to jQuery 3.

See jQuery’s .on() documentation for more info.



This post was published on September 11th, 2018 by Robert James Reese in the following categories: JavaScript and jQuery Before using any of the code or other content in this post, you must read and agree to our terms of use.