12
Every time I use the Jsfiddle see options to initialize jQuery content via onLoad
or onDomready
.
I tested with most of the scripts I write and there was no functional difference. Searching on Google I saw that one of the main differences is that I saw onLoad
scripts only start running after all elements are loaded and this includes CSS, JS, images, etc., which can be useful if you need to upload files javascript in a certain order, but at some point one of these files refers to another that has not yet been loaded, while onDomready
once loaded the HTML content of the page the scripts start to be loaded already without necessarily the others have been.
- I understood this difference correctly?
- Is there any other difference to be studied and perceived?
Another difference is that with jQuery.onload there can be problems with cached images in IE.
– Philippe Gioseffi
I posted this question in the OS too and a user showed me this fiddle. Basically, you can have several onDomready, while onload only once.
– Philippe Gioseffi
@Philippegioseffi It’s an interesting difference. Thanks for sharing!
– afsantos
Actually you can have several onload, if you keep reading it shows this, but nothing that is tied to an onload that has already been loaded, kind of confusing business.
– Philippe Gioseffi