jQuery events | How to use mouse click, keyboard, load and other event methods in jquery
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
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”).mouseenter ();
e.g. $(“p”).mouseleave ();
jQuery mousedown event
e.g. $(“p”).mousedown ();
jQuery mouseup event
e.g. $(“p”).hover ();
jQuery Unload event
jQuery Select event
- How to use jQuery keydown with example
- jQuery keyup | How to use keyup event in jquery with example
- jQuery set focus | How to set focus to html element using jQuery
- How to use jQuery mouseenter() method
- jQuery mouseleave | How to use mouseleave() event method in jQuery
- jQuery blur | How to use blur method of jQuery as element loosed focus
- jQuery preventDefault() method
- jQuery keypress | How to use keypress event in jQuery with example