Web Development Ninjas Question:

Explain me what is $(document).ready() function? Why should you use it?

Tweet Share WhatsApp

Answer:

This is one of the most important and frequently asked questions. The ready() function is used to execute code when document is ready for manipulation. jQuery allows you to execute code, when DOM is fully loaded i.e. HTML has been parsed and the DOM tree has been constructed. The main benefit of $(document).ready() function is that, it works in all browser, jQuery handles cross browser difficulties for you. For curious reader see answer link for more detailed discussion.

Download Ninjas Web Developer PDF Read All 58 Ninjas Web Developer Questions
Previous QuestionNext Question
Explain me how do you set an attribute using jQuery?Tell me what is the difference between SVG and <Canvas>?