- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
When to use $(document).ready() and when $(window).load() in jQuery?
$(window).load()
Use $(window).load(), when you want the code inside it to run only once the entire page is ready (not only DOM). It executes when the page is fully loaded, including frames, objects and images
Note: The load() method deprecated in jQuery version 1.8. It was completely removed in version 3.0. To see its working, add jQuery version for CDN before 3.0.
$(document).ready()
Use the $(document).ready() method when you want the code inside it to run once the page DOM is ready to execute JavaScript code.
- Related Articles
- What is the difference between $(window).load() and $(document).ready() functions in jQuery?
- What is $(document).ready() method in jQuery?
- What are jQuery events .load(), .ready(), .unload()?
- What is $(window).load() method in jQuery?
- How to use jQuery.getJSON to load JSON file in jQuery?
- When to use inline function and when not to use it in C/C++?
- When to use an abstract class and when to use an interface in Java?
- jQuery ready() with Examples
- What is $(document).ready() equivalent in JavaScript?
- When to use MyISAM and InnoDB?
- When should I use an Inline script and when to use external JavaScript file?
- Execute a script when the media is ready to start playing in HTML?
- Execute a script when a file is ready to start playing in HTML?
- How to check if a document is ready in JavaScript?
- When to use new operator in C++ and when it should not be used?

Advertisements