jQuery Event How to - Handle Document ready event








Question

We would like to know how to handle Document ready event.

Answer


 <!--  www .j a  v a2  s. c om-->
<html>
  <head>
    <script type="text/javascript" src='http://code.jquery.com/jquery-1.5.2.js'></script>

    <script type="text/javascript">
 $(document).ready(function(){

     console.log("Hi");

 });


    </script>
  </head>
  <body>
    <a href="http://jquery.com/">jQuery</a>
  </body>
</html>

The code above is rendered as follows: