top of page

jQuery is tailor-made to handle HTML/DOM events.


jQuery Event Methods


Event handlers are methods that are called when "something happens" in HTML.
The term "triggered (or "fired") by an event" is often used.
It is common to put jQuery code into event handler methods in the <head> section.
In the example below, a function is called when the click event for the button is triggered:


 


<html>

<head>

<script src="jquery.js"></script>

<script> $(document).ready(function()

{ $("button").click(function(){ $("p").hide(); }); });

</script>

</head>

<body>

<h2>This is a heading</h2>

<p>This is a paragraph.</p>

<p>This is another paragraph.</p>

<button>Click me</button> </body>
</html>

 

Some jQuery Event Methods


Here are some examples of event methods in jQuery:


Event Method                                                 Description                                      

 

$(document).ready(function)                     Specifies a function to execute when the

                                                                  DOM is fully loaded
 

                                                                 Binds/Triggers the click event
 

                                                                 Binds/Triggers the double click event
                           

                                                                  Binds/Triggers the focus event
               

                                                                  Binds/Triggers the mouseover event

Jquery Event

Add Events To Your Page

bottom of page