.load (fn) does not work when migrating to .on ('load') Jquery 3.1

1

After having updated from .load () to .on ('load') , it gives problems, in chrome the code is not executed when it is loaded the first time, I have to refresh the page again several times. The same happens in Internet explorer.

Migrate from jquery 1.11 to version 3.1

Any idea why this may be happening?

    
asked by Cristobal 31.10.2016 в 16:31
source

2 answers

0

We go in parts:

.load Upload data from the server from a specific URL and place the result content in a defined element.

load event Occurs when an element and its child elements have fully loaded, this event applies only to a certain type of HTML elements.

Now, a warning about using images with load event on('load', function(){...}) :

  • Does not work consistently or reliably in different browsers.
  • It does not run correctly in WebKit (the engine that has Google Chrome) if the image src is set to the same src as before.
  • Does not correctly make the bubble up to the DOM tree
  • You can stop showing images that already live in the browser cache.
  • Considering the little information shown in your question, I feel it has to do with point 2 and point 4.

        
    answered by 31.10.2016 в 16:56
    -1

    The only solution I found was to use version 2.4 of Jquery and not 3.1

        
    answered by 22.12.2016 в 19:58