jQuery ready() Method

jQuery ready() event occurs when the document object model (DOM) is fully loaded. jQuery read() method triggers to initialize all jQuery events methods.

Syntax

This syntax represent to the ready() method

$(document).ready(function);
Parameter Type Description
function Function Required. Specifies the function to execute after the document is loaded

Examples

This example represent the mouseover event

<!DOCTYPE html>
<html>
<head>
  <title>jQuery ready() method</title>
  <script src="jquery-latest.min.js"></script>
  <script>
    $(document).ready(function(){
      $("p").hide();    
      $("#btn1").click(function () {
        $("p").toggle("slow");
      });
    });
  </script>
</head>
<body>
  <div>
    <p>first paragraph start here...</p>
  </div>
  <button id="btn1">Click Me</button>
</body> 
</html>

Run it...   »