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
  • 43,936
  • 58
  • 171
  • 251

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
  • 70,503
  • 15
  • 107
  • 148