0

jQuery .load() was deprecated in version 1.8.

If I wanted to perform the following task:

$(window).load(function () {
  // run code
});

How would I do this in jQuery 1.9+?

L84
  • 45,514
  • 58
  • 177
  • 257

1 Answers1

2

That was just a shortcut to the equivalent .on call, so use that instead:

$(window).on('load', function () {
    // run code
});

If you don't care about multiple handlers, you can go with the basic window.onload = function....

bfavaretto
  • 71,580
  • 16
  • 111
  • 150