jquery--2nd Lesson, event, package set

Source: Internet
Author: User
Tags prev

I. jquery events

What is an event?

The response of a page to a different visitor is called an event.

The event handler refers to the method that is called when certain events occur in the HTML.

Instance:

    • Move the mouse over the element.
    • Select radio button
    • Click on the element

The term "trigger" (or "fire") is often used in events such as: "Triggers KeyPress event when you press a key."

Common jquery events: 1, Click () a function is called when the button click event is triggered .2. Ready () executes the function 3 after the document is fully loaded. DblClick ()The DblClick event occurs when you double-click an element. 4. MouseEnter ()The MouseEnter event occurs when the mouse pointer passes through an element. 5. MouseLeave ()The MouseLeave event occurs when the mouse pointer leaves the element. 6. MouseDown ()The MouseDown event occurs when the mouse pointer moves over the element and the mouse button is pressed. 7. MouseUp ()The MouseUp event occurs when the mouse button is released on the element. 8. hover ()Used to simulate cursor hover events. 9. Focus ()When the element receives focus, the focus event occurs, and the element receives the focal point when the element is clicked by a mouse click or the TAB key to navigate to the element. 10. Blur ()The Blur event occurs when the element loses focus.

II. management of packaging set 1, determine the size of the package set length

The Length property contains the number of elements in the JQuery object.

Syntax: $ (selector). length

2. Get the position of the element in the package set index ()

The index () method returns the index position of the specified element relative to the other specified element.

These elements can be specified by JQuery selectors or DOM elements.

(1), the index of the first matching element, relative to the sibling element

Gets the index position of the first matching element relative to its sibling element.

Syntax: $ (selector). Index ()

(2), index of the element, relative to the selector

Gets the index position of the element relative to the selector.

The element can be specified by a DOM element or JQuery selector.

Syntax: $ (selector). Index (element)

3. Add element to package set Add ()

The Add () method adds an element to the collection of matching elements

Syntax:. Add (elements)

4. Delete the element in the package set not ()

Not () removes the element from the matching element collection.

Syntax:. Not (element)

5. Filter the elements in the package set ()

The filter () method reduces the set of matching elements to the element that matches the specified selector.

Syntax:. Filter (selector)

6. Get a subset of the package set slice ()

Slice () reduces the set of matching elements to a subset of the specified exponential range.

Syntax:. Slice (selector,end)

Iii. selectors in jquery 1, hierarchy selector 1, descendant element selector: used to find all descendant elements under a given element

Syntax: $ ("Amcestor descendant")

2. Child element selector: used to find all direct elements under a given element

Syntax: $ ("Parent>child")

3. Next to sibling element selector: Used to select sibling elements of a given element

Syntax: $ ("Prev+next")

4. Neighboring sibling element selector: An element that selects all siblings after the Prev element

Syntax: $ ("prev~siblings")

2. Filter selector 1, animation element selector: Animated

Selector selects all the current animation elements

Syntax: $ (": animated")

2, Focus element selector: Focus

The selector is used to pick the element that gets focus.

3. Element selector: First

: The first selector selects the second element.

Syntax: $ (": First")

4. Final element selector: last 5, non-element selector: not (selector) 6, even element selector: Even 7, odd element selector: Odd 8. Equal element selector: EQ (index) 9, greater than element selector: GT (Index) 10, less than element selector: LT (index) 11, Title element selector: header (Ind Ex) 3, Content filter selector 1, empty content selector: Emoty 2, Element content selector: has (selector) 3, parent element selector:p arent 4, visibility filtering Device 1, Hidden element selector: Hidden 2, visible element selector: Visible

jquery--2nd Lesson, event, package set

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.