python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
document.ready() vs body.onload() function in jQuery

What is $(document).ready() function? Why we use it?










The $(document).ready() function is  use to execute the code when the DOM is fully loaded.  We can say that $(document).ready() is an event which is fire when DOM is fully loaded or ready to use.

Document Ready function:-

We can call more than one document.ready() function in single page.
The document.ready() function is called when DOM is not fully loaded that means rest of images, css or other 3rd party reference on page.

It will not wait for the images, css or other 3rd party to get loaded.

The ready and load events:
1.      $(document).on('ready', handler)
2.      $(document).on('load', handler)

I Hope it is helpful to you! Thank you!

ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions