Introduction to jQuery
JQuery Syntax
JQuery Effects
JQuery HTML
JQuery Traversing
Events are actions that happen in the browser — like when a user clicks a button, hovers over text, types into a form, or when a page finishes loading.
jQuery makes it super easy to detect and respond to these events using simple methods.
Mouse Event |
Eeyboard Event |
Form Event |
---|---|---|
click() |
keydown() |
focus() |
dblclick() |
keypress() |
blur() |
mouseenter() |
keyup() |
change() |
mouseleave() |
|
submit() |
mousedown() |
|
|
mouseup() |
|
|
hover() |
|
|
These trigger when the user interacts with the mouse.
Fires when an element is clicked
Try it yourself
Fires when an element is double-clicked
Try it yourself
Fires when the mouse enters an element
Try it yourself
Fires when the mouse leaves an element
Try it yourself
When mouse button is pressed down
Try it yourself
When mouse button is released
Try it yourself
Shortcut for mouseenter
+ mouseleave
Try it yourself
Fires when a key is released
Try it yourself
Fires when a key is pressed down
Try it yourself
The keypress
event in jQuery is triggered when the user presses a key on the keyboard. It works primarily for character keys (like letters and numbers), but does not detect non-character keys (like Shift
, Esc
, or Arrow
keys).
Try it yourself
Fires when an element gains focus
Try it yourself
Fires when an element loses focus
Try it yourself
Fires when the value of an element changes
Try it yourself
Fires when a form is submitted
Try it yourself