Home >>jQuery Tutorial >jQuery ready() Method

jQuery ready() Method

jQuery ready() Method

jQuery ready() method in jQuery is used to specifies what happens when a ready event occurs when the DOM (document object model) has been loaded.


Two syntaxes can be used:


The ready() method can only be used on the current document, so no selector is required:


Parameter Values

Parameter Description
function It is a required parameter and used to specifies the function to run after the document is loaded
Here is an Example of jQuery ready() Method:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<p class="txt">This is Phptpoint</p>
<button class="btn1">click me to toggle p element</button>


This is Phptpoint