#
JQuery Events
This tutorial will answer you at the following questions: 'What a is JQuery Event?', 'Which are the JQuery Events ?'.
#
What is a JQuery Event is ?
Events are actions that can be detected by your Web Application. JQuery makes it easy to respond to user interaction with a web page. This means that you can write code that runs when a user clicks on a certain part of the page, or when she moves her mouse over a form element. We have the ability to create dynamic web pages by using events.
#
Which are the JQuery Events ?
Here are the most used events:
click()
: Bind an event handler to the “click” JavaScript event, or trigger that event on an element.change()
: Bind an event handler to the “change” JavaScript event, or trigger that event on an element.dblclick()
: Bind an event handler to the “dblclick” JavaScript event, or trigger that event on an element.error()
: Bind an event handler to the “error” JavaScript event.focus()
: Bind an event handler to the “focus” JavaScript event, or trigger that event on an element.hover()
: Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.keydown()
: Bind an event handler to the “keydown” JavaScript event, or trigger that event on an element.keypress()
: Bind an event handler to the “keypress” JavaScript event, or trigger that event on an element.load()
: Bind an event handler to the “load” JavaScript event.mousedown()
: Bind an event handler to the “mousedown” JavaScript event, or trigger that event on an element.submit()
: Bind an event handler to the “submit” JavaScript event, or trigger that event on an element.
For more JQuery events you can take a look here.
Here is a little example:
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
In this example you can see the following events:
ready()
: Specify a function to execute when the DOM is fully loaded.click()
: Bind an event handler to the “click” JavaScript event, or trigger that event on an element.
Info
The hide() function is not an event. It is an API.