What Does "$(document).ready()" mean and How to Use?

What Does "$(document).ready()" mean and How to Use?

What Does $(document).ready() Mean and How to Use? If you are using jQuery you can safely use your code to do anything to your page. All you need to do is ensuring your that the page is ready for manipulating. We accomplish this by writing our code in a function, and later we pass that function to $(document).ready(). As you can see sample below, the function we pass can just be an anonymous function.

It is very easy to read:

1. $( document ) --> this stands for the document and here it is entire page

2. .ready() --> a method that tell us if the document is ready or not

3. function() { } --> our function we run after page is ready!

$() Alternative for $(document).ready()

You can also use a shorthand method for $(document).ready() if you prefer. You can simply use $() instead.

Joomla Templates
Popup now! Make a Difference!