Sunday, 7 October 2012

.ready() function in JQuery | $(document).ready() | jQuery Event ready() Method

                                  Hi friends , in this article I will explain about  .ready()  method in JQuery with example.
                                 I already explained in the previous article What is JQUERY | JQuery Tutorial | JQuery syntaxes. See once if you want to know.
  • jQuery is a JavaScript Library.
  • It simplifies the JavaScript programming.
  • jQuery is a lightweight "write less, do more" JavaScript library.
  • It is a library of JavaScript functions.
We have to use the below line to execute the JQuery functions, jquery.js is mandatory. Because all Jquery functions or methods are included in the JQuery.js library.

<script type="text/javascript" src="jquery.js"></script>

JQuery Ready() Method:

The .ready () method is generally incompatible with the <body onload=""> attribute.
If load must be used, either do not use .ready () or use jQuery's  .load() method to attach load event handlers to the window or to more specific items, like images.
Use ready() to make a function available after the document has been loaded:
All three of the following syntaxes are equivalent:

$().ready(handler) //(this is not recommended)

Syntax for JQuery Ready method is
$(document).ready(function() {
  // write the code like click function for .ready() called.

The following program will explain the how the ready function will work.

<html xmlns="" >
<head runat="server">
    <script type="text/javascript" src="jquery.js"></script>
    <script type ="text/javascript" language ="javascript">
    $(document).ready(function(){alert("Enter into the Ready function.")
     $('p').text("Click me !!!!!!! i will disappear"); // assigning data to p  
    <form id="form1" runat="server">

                        In the above example when we execute the above page it will automatically displays the ‘p’ as Click me !!!!!!! i will disappear.
Actually ready () method in JQuery is equal to the load () method in body tag.
I think you like my blog Aspdotnet-Roja why are waiting following me on facebook fan page Aspdotnet-roja

No comments:

Post a Comment

© 2012-2018 All Rights Reserved.
The content is copyrighted to Kishore and may not be reproduced on other websites without permission from the owner.