Quick Reach
jQuery events
Events are user’s actions on a web page that web page can respond to. For example pressing a keyboard key, bringing mouse pointer to a link, click that link, while page is loading, page is closed or unloading and many more actions.
Fortunately, jQuery is tailor-made to respond to many useful events that webpage can get. As a user triggers those events, custom function or actions can be performed by catching those events in event handlers.
Events that are supported by jquery can be categorized into following:
- Mouse events e.g. click event, double click event
- Keyboard events e.g. keypress, keydown, keyup
- Form Events e.g. form submit event
- Document events e.g. load event, resize event
In this chapter we will explain how to use event methods of jquery with example. Below you can also find many useful event links for their respective detailed chapters with examples.
Syntax of jquery event method
selector.event_method();
e.g. $(“p”).click();
$(“p”).dblclick();
Useful / Mostly used jQuery event’s methods
Below is the list of useful event methods with basic example. Click on any method for full detail and running example to learn fully.
jQuery Mouse Events
e.g. $(“p”).click();
$(“p”).dblclick();
e.g. $(“p”).mouseenter ();
e.g. $(“p”).mouseleave ();
jQuery mousedown event
e.g. $(“p”).mousedown ();
jQuery mouseup event
e.g. $(“p”).mouseup();
e.g. $(“p”).hover ();
Keyboard events
e.g. $(“p”).keypress();
e.g. $(“p”).keydown();
e.g. $(“p”).keyup();
Document events
e.g. $(“my_form”).submit()
e.g. $(“input”).change()
e.g. $(“p”).focus()
e.g. $(“input”).blur
Windows events
e.g. $(selector).load(function)
e.g. $(window).resize
e.g. $(“div”).scroll
jQuery Unload event
e.g. $(window).unload
Other events
e.g. $(“p”).bind
e.g. $(“div”).delegate
$(“p”).on
jQuery Select event
$(“input”).select
Leave A Comment?