jQuery Home

Events

click()

The click() method triggers the click event.

The event can be applied to all <p> elements on a page like this.


dblclick()

The dblclick() method triggers the dblclick event.

The dblclick event also generates a click event. This can cause problems if both events are applied to the same element.


mouseenter()

The mouseenter event occurs when the mouse pointer is over (enters) the selected element.

Unlike the mouseover event, the mouseenter event only triggers when the mouse pointer enters the selected element. The mouseover event is triggered if a mouse pointer enters any child elements as well.


mousemove()

The mousemove event occurs whenever the mouse pointer moves within the selected element.


mouseover()

The mouseover event occurs whenever the mouse pointer is over the selected element.


mouseleave()

The mouseleave event occurs when the mouse pointer leaves the selected element.

Unlike the mouseout event, the mouseleave event only triggers when the mouse pointer leaves the selected elements. The mouseout event is triggered if a mouse pointer leaves any child elements as well as the selected element.


mouseout()

The mouseout event occurs when the mouse pointer leaves the selected element.


mousedown()

The function is executed, when the left, middle or right mouse button is pressed down, while the mouse is over the HTML element.


mouseup()

The function is executed, when the left, middle or right mouse button is released, while the mouse is over the HTML element.


keydown()

The keydown event occurs when a keyboard key is pressed down.


keyup()

The keyup event occurs when a keyboard key is released.


keypress()

The keypress event is similar to the keydown event. The event occurs when a button is pressed down.

However, the keypress event is not fired for all keys (e.g. ALT, CTRL, SHIFT, ESC). Use the keydown() method to also check these keys.


event.type Property()

The event.type property returns which event type was triggered.


hover()

The hover() method takes two functions and is a combination of the mouseenter() and mouseleave() methods.

The first function is executed when the mouse enters the HTML element, and the second function is executed when the mouse leaves the HTML element.


focus()

The focus event occurs when an element gets focus (when selected by a mouse click or by "tab-navigating" to it).

The input boxes will change background color, upon triggering the event.


focusin()

The focusin event occurs when an element (or any elements inside it) gets focus.

Unlike the focus() method, the focusin() method also triggers if any child elements get focus.


focusout()

The focusout event occurs when an element (or any elements inside it) loses focus.

Unlike the focus() method, the focusout() method also triggers if any child elements lose focus.


select()

The select event occurs when text is selected (marked) in a text area or a text field.


submit()

The submit event occurs when a form is submitted.

This event can only be used on <form> elements.


trigger()

The trigger() method triggers the specified event and the default behavior of an event (like form submission) for the selected elements.


triggerHandler()

The triggerHandler() method triggers the specified event for the selected element.


blur()

The blur() method attaches an event handler function to an HTML form field.

The function is executed when the form field loses focus.


change()

The change event occurs when the value of an element has been changed (only works on <input>, <textarea> and <select> elements).

The change() method triggers the change event, or attaches a function to run when a change event occurs.


on()

The on() method attaches one or more event handlers for the selected elements.

Attach multiple event handlers to a <p> element.


off()

The off() method is most often used to remove event handlers attached with the on() method.


one()

The one() method attaches one or more event handlers for the selected elements, and specifies a function to run when the event occurs.

When using the one() method, the event handler function is only run ONCE for each element.


event.Target Property

The event.target property returns which DOM element triggered the event.


event.currentTarget Property

Reference to the element whose event listener is being processed.


event.relatedTarget Property

The event.relatedTarget property returns which element being entered or exited on mouse movement.


event.result Property

The event.result property contains the last/previous value returned by an event handler triggered by the specified event.

This result will be displayed in the contents of the paragraph below the button.


event.data Property

The event.data property contains the optional data passed to an event method when the current executing handler is bound.


event.delegateTarget Property

The event.delegateTarget property returns the element where the currently-called jQuery event handler was attached.


event.preventDefault() Method

The event.preventDefault() method stops the default action of an element from happening.


event.isDefaultPrevented() Method

The event.isDefaultPrevented() method checks whether the preventDefault() method was called for the event.


event.isImmediatePropagationStopped() Method

The event.isImmediatePropagationStopped() method checks whether the event.stopImmediatePropagation() method was called for the event.


event.isPropagationStopped() Method

The event.isPropagationStopped() method checks whether the event.stopPropagation() method was called for the event.


event.stopImmediatePropagation() Method

The event.stopImmediatePropagation() method stops the rest of the event handlers from being executed.


event.stopPropagation() Method

The event.stopPropagation() method stops the bubbling of an event to parent elements, preventing any parent event handlers from being executed.


event.namespace Property

The event.namespace property returns the custom namespace when the event was triggered.


event.pageX Property

The event.pageX property returns the position of the mouse pointer, relative to the left edge of the document.


event.pageY Property

The event.pageY property returns the position of the mouse pointer, relative to the top edge of the document.


event.timeStamp Property

The event.timeStamp property returns the number of milliseconds since the document was loaded.


event.which Property

The event.which property returns which keyboard key or mouse button was pressed for the event.


$.proxy() Property

The $.proxy method takes an existing function and returns a new one with a particular context.


resize() Method

The resize event occurs when the browser window changes size.

The resize() method triggers the resize event, or attaches a function to run when a resize event occurs.


scroll() Method

The scroll event occurs when the user scrolls in the specified element.

The scroll event works for all scrollable elements and the window object (browser window).