jQuery Event Methods with Examples
jQuery Event Methods allow you to attach a function to an event handler for the selected elements. jQuery event methods represents the action that perform for a specific times. Following are jQuery event methods
| jQuery Method | Description |
|---|---|
| bind() | Attach one or more event handlers to elements Deprecated in jQuery 3.0. Use the on() method instead of this |
| blur() | This event occurs when an element loses a focus |
| change() | This event occurs when the value has been changed on selected element. Works only for <input>, <textarea>, and <select> elements |
| click() | This event occurs when an element is clicked |
| dblclick() | This event occurs when an element is double clicked |
| delegate() | This event occurs when attaches one or more event handlers for specific elements that are child of selected elements Deprecated in jQuery 3.0. Use the on() method instead of this |
| die() | This method removes one or more event handlers, used with the live() method, for the selected elements Removed in jQuery 1.9 |
| error() | This event occurs when selected element occur an error for example element not loaded correctly Removed in jQuery 3.0 |
| event.pageX | This event occurs when mouse position relative to the left edge of the document |
| event.pageY | This event occurs when mouse position relative to the top edge of the document |
| event.timeStamp | When the event is triggered, it will returns the number of milliseconds since January 1, 1970 |
| event.which | When the event is triggered, it will returns the number of which keyboard key or mouse button was pressed |
| focus() | This event occurs when selected element gets focus |
| focusin() | This event occurs when selected element or any elements inside it gets focus |
| focusout() | This event occurs when selected element or any elements inside it loses focus |
| hover() | This event occurs when the mouse pointer hovers over the selected elements |
| keydown() | This event occurs when a keyboard key is on way to press down |
| keypress() | This event occurs when a keyboard key is pressed down |
| keyup() | This event occurs when a keyboard key is released up |
| live() | This event occurs when attaches one or more event handlers for selected elements and execute specified function Removed in jQuery 1.9 |
| load() | This event occurs when a specified element has been loaded Removed in jQuery 3.0 |
| mousedown() | This event occurs when a mouse button is pressed down on the selected element |
| mouseenter() | This event occurs when a mouse pointer is enters into the selected element |
| mouseleave() | This event occurs when a mouse pointer is leaves the selected element |
| mousemove() | This event occurs when a mouse pointer moves with in the selected element |
| mouseout() | This event occurs when a mouse pointer is leaves any child elements as well as the selected element |
| mouseover() | This event occurs when a mouse pointer is enters into any child elements as well as the selected element |
| mouseup() | This event occurs when a mouse button is released over the selected element |
| ready() | This event occurs when the document object model (DOM) is fully loaded |
| select() | This event occurs when a text is selected in a text field or textarea. |
| submit() | This event occurs when a form is submitted. |
| unload() | This event occurs when the user perform any page away action such as close window, page reload, forward/back buttons etc Removed in jQuery 3.0 |