From 87f3497323c266ff87320075069e954a8eab7942 Mon Sep 17 00:00:00 2001 From: Rishi Verma Date: Wed, 7 Sep 2016 11:34:53 -0700 Subject: [PATCH] Update document-ready.md $( window ).load(function () {}) deprecated since v1.8. Should use $( window ).on("load", function () {}) https://github.com/jquery/jquery/issues/2286 --- page/using-jquery-core/document-ready.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/page/using-jquery-core/document-ready.md b/page/using-jquery-core/document-ready.md index da379ebe..b2f83026 100644 --- a/page/using-jquery-core/document-ready.md +++ b/page/using-jquery-core/document-ready.md @@ -3,7 +3,7 @@ "level": "beginner" } -A page can't be manipulated safely until the document is "ready." jQuery detects this state of readiness for you. Code included inside `$( document ).ready()` will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute. Code included inside `$( window ).load(function() { ... })` will run once the entire page (images or iframes), not just the DOM, is ready. +A page can't be manipulated safely until the document is "ready." jQuery detects this state of readiness for you. Code included inside `$( document ).ready()` will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute. Code included inside `$( window ).on("load", function() { ... })` will run once the entire page (images or iframes), not just the DOM, is ready. ``` // A $( document ).ready() block. @@ -32,10 +32,10 @@ function readyFn( jQuery ) { $( document ).ready( readyFn ); // or: -$( window ).load( readyFn ); +$( window ).on("load", readyFn ); ``` -The example below shows `$( document ).ready()` and `$( window ).load()` in action. The code tries to load a website URL in an `