- 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
What is $(document).ready() equivalent in JavaScript?
In jQuery, if you want an event to work on your page, you should call it inside the $(document).ready() function. Everything inside it will load as soon as the DOM is loaded and before the page contents are loaded.
$(document).ready(function() { alert(“Document loaded successful!"); });
Example
In JavaScript, to achieve the same result like $(document).ready, try the following code −
<html> <body> <script> var loader = setInterval(function () { if(document.readyState !== "complete") return; clearInterval(loader); alert(“Document loaded successful!"); // document.write("Document loaded successful!"); }, 300); </script> </body> </html>
- Related Articles
- What is $(document).ready() method in jQuery?
- How to check if a document is ready in JavaScript?
- What is the difference between $(window).load() and $(document).ready() functions in jQuery?
- Need Selenium to wait until the document is ready
- When to use $(document).ready() and when $(window).load() in jQuery?
- Is their a negative lookbehind equivalent in JavaScript?
- What is equivalent ratio?
- Is their a JavaScript Equivalent to PHP explode()?
- What is the Certainty Equivalent Method?
- What is Document Clustering Analysis?
- What is the equivalent of EXCEPT in MySQL?
- What is the PHP stripos() equivalent in MySQL?
- Create HTML Document with Custom URL for the document in JavaScript
- What is the difference between HD ready and Full HD Televisions?
- What are jQuery events .load(), .ready(), .unload()?

Advertisements