How to write jquery code in a different ways

Using below program, i am explaining how to write jquery code in a different ways.


<!DOCTYPE>

<html>
<head>
    <title></title>
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <!--www.jqueryexamplecode.blogspot.com -->
    <script>
        //standared way of jQuery function
        $('document').ready(function() {
            alert('DOM is ready. standared way of jquery syntax');
        });

        //this is also same as above standared
        $(function() {
            alert('Dom is ready. Second way of writing jquery function');
        });


        // Passing a named function instead of an anonymous function.
        $(function($) {
            alert('DOM is ready. This is third way of writing jquery function');
        });
    
    </script>
</head>
<body>
    <h1>www.jqueryexamplecode.blogspot.com</h1>
</body>
</html>
 



If you have any queries or suggestions, please feel free to ask in comments section.
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