(4)--jquery event and event object ① in jquery Chapter

Source: Internet
Author: User

For the event, everyone is certainly not unfamiliar. jquery events are the same as JavaScript events, except that jquery encapsulates cross-browser events, and everyone works, without having to write a bunch of logic to judge the disgusting cross-browser differences.

1. Events

(1) Blur ([[DATA],FN]): Triggers the blur event when the element loses focus. This function invokes all functions that bind to the Blur event, including the default behavior of the browser. You can prevent the default behavior of the browser from triggering by returning false. The Blur event is triggered when the element loses focus, either as a mouse behavior or as a tab key to leave.

(2) Change ([[[DATA],FN]): When the value of an element is changed, a variation event occurs. This event applies only to the text field, as well as to the textarea and select elements. When used with a SELECT element, the Change event occurs when an option is selected. When used with the text field or text area, the event occurs when the element loses focus.

(3) Click ([[DATA],FN]): Triggers the Click event for each matching element. This function invokes all functions that perform binding to the Click event.

(4) DblClick ([[DATA],FN]): The DblClick event occurs when the element is double-clicked. A click occurs when the mouse pointer rests over the element and then presses and releases the left mouse button. A double click event occurs two times in a short period of time. Tip: If you apply the DblClick and click events to the same element, problems may arise.

(5) error ([[[DATA],FN]): The error event occurs when an element encounters an error (not loaded correctly).

(6) Focus ([[[DATA],FN]): Triggers the focus event when the element receives the focal point. Can be triggered by mouse clicks or tab navigation on the keyboard. This will trigger all the bound focus functions, noting that some objects do not support the focus method.

(7) Focusin ([DATA],FN): Triggers the Focusin event when the element receives focus. The Focusin event differs from the focus event in that he can detect when a child element gets focus on a parent element.

(8) Focusout ([DATA],FN): Triggers the Focusout event when the element receives focus. The Focusout event differs from the Blur event in that he can detect the child element's focus on the parent element.

(9) KeyDown ([[DATA],FN]): The KeyDown event occurs when the keyboard or button is pressed. Note: If you set on a document element, the event occurs regardless of whether the element has the focus.

KeyPress ([[DATA],FN]): The KeyPress event occurs when the keyboard or button is pressed. The KeyPress event is similar to the KeyDown event. The event occurs when the button is pressed. It occurs on the element that is currently gaining focus. However, unlike the KeyDown event, the KeyPress event occurs every insertion of a character. Note: If you set on a text element, the event occurs regardless of whether the element receives focus.

(one) KeyUp ([[DATA],FN]): The KeyUp event occurs when the button is released. It occurs on the element that is currently gaining focus. Note: If you set on a document element, the event occurs regardless of whether the element has the focus.

MouseDown ([[DATA],FN]): The MouseDown event occurs when the mouse pointer moves over the element and the mouse button is pressed. Unlike the Click event, the MouseDown event only needs to be pressed by the MouseDown button, and it does not need to be loosened to occur.

MouseEnter ([[DATA],FN]): The MouseEnter event occurs when the mouse pointer crosses an element. This event is most often used in conjunction with the MouseLeave event. Unlike the MouseOver event, the MouseEnter event is triggered only when the mouse pointer passes through the selected element. The MouseOver event is also triggered if the mouse pointer passes through any child elements.

MouseLeave ([[DATA],FN]): The MouseLeave event occurs when the mouse pointer leaves the element. This event is most often used in conjunction with the MouseEnter event. Unlike the Mouseout event, the MouseLeave event is triggered only when the mouse pointer leaves the selected element. If the mouse pointer leaves any child elements, the Mouseout event is also triggered.

(MouseMove) ([[DATA],FN]): The MouseMove event occurs when the mouse pointer moves through the specified element. The MouseMove event handler is passed a variable-event object whose. ClientX and. ClientY properties represent the coordinates of the mouse.

(+) Mouseout ([[DATA],FN]): The Mouseout event occurs when the mouse pointer moves away from the element. This event is most often used in conjunction with the MouseOver event.

MouseOver ([[DATA],FN]): The MouseOver event occurs when the mouse pointer is over an element. This event is most often used in conjunction with the Mouseout event.

MouseUp ([[DATA],FN]): The MouseUp event occurs when the mouse button is relaxed on the element. Unlike the Click event, the MouseUp event requires only the Relax button. When the mouse pointer is over the element, the event is triggered when the mouse button is relaxed.

(+) Resize ([[DATA],FN]): The Resize event occurs when the size of the browser window is resized.

(scroll) ([[DATA],FN]): The scroll event occurs when the user scrolls the specified element. The Scroll event applies to all scrollable elements and window objects (browser windows).

select ([[[DATA],FN]): A Select event occurs when the text in the input element of the textarea or text type is selected.

Submit ([[DATA],FN]): When the form is submitted, a submit event occurs. This event applies only to form elements.

Unload ([[DATA],FN]): The Unload event occurs when the user leaves the page.

2. Event switching

(1) hover ([Over,]out): A method that mimics the hover event (the mouse moves over an object and moves out of the object). This is a custom method that provides a "keep in" state for frequently used tasks. The first function that is specified is triggered when the mouse moves over a matching element. When the mouse moves out of this element, the specified second function is triggered. Also, with the detection of whether the mouse is still in a particular element (for example, an image in a div), it will continue to stay in the "hover" state without triggering a move-out event (fixed a common error using the Mouseout event).

Over: The mouse moves to the function to be triggered on the element

Out: The mouse moves out of the element to trigger the function

(2) toggle ([SPEED],[EASING],[FN]): Used to bind two or more event handler functions in response to a rotating click event of the selected element. If the element is visible, toggle to hidden, or toggle to visible if the element is hidden.

(4)--jquery event and event object ① in jquery Chapter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.