The Document Ready Function

Share this article

The jQuery document ready function is used as an outer container for all of your jQuery functions and event code. It’s purpose is that it only loads the jQuery code once your HTML has fully loaded in the webpage. This allows it to add functions and events to HTML objects held within the DOM and prevent loading errors.

This is how you do it:


 // jQuery functions go here...



Sam DeeringSam Deering
View Author

Sam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.

jQueryprevent loading errors
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form