What is use JQuery ready function in the DOM?

We can use ready function using several ways in the JQuery. The ready function will fire after all the DOM data was loaded. Below example shows, in how many ways we can use ready function in JQuery. We can use how many ready events we want in our script. there is not limit for ready event count, these will execute sequentially.

    <title>JQuery DOM Operations</title>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">

    <script type="text/javascript">
        // Standard way to call DOM.
        jQuery(document).ready(function() { alert('DOM ready'); });
        // This is short cut way as above.
        jQuery(function() { alert('here also DOM ready'); });
        // Shortcut with fail-safe usage of $. reference of jquery function 
        // should pass into the anonymous function.
        jQuery(function($) {
            alert('already DOM is ready');
            // Use $() which is recommanded way.


Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar