jQuery Event Methods
The jQuery event methods are take effect when the user interacts with the browser to register behaviors, and manipulate those registered behaviors furthers.
jQuery event methods trigger, or bind function to an event.
Trigger example:
$("button").click() - Trigger generate on the click event of button element.
Binding example:
$("button").click(function(){$("img").hide()}) - This method bind the function on click event.
jQuery bind() example:
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="jquery.js"></script> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("button").bind("click", function () { $("p").slideToggle(); }); }); </script> </head> <body> <p>This is my first paragraph.</p> <button>Click me!</button> </body> </html> |