Sharp jquery Essentials Induction (i) jquery selector _jquery

Source: Internet
Author: User
Tags prev
1 Basic selectors

$ (#id)
Matches an element based on the given ID
$ (. Class)
Matches the element based on the given class name
$ (Element)
Matches the element based on the given element name
$(*)
Match all elements
$ (Selector1,selector2,..., Selectorn)
The elements that match each selector are merged and returned together

2 level Selector

$ ("ancestor descendant")
Select all descendant (descendant) elements in the ancestor element
$ ("Parent > Child")
Select only the child (sub-level) element under the parent element, which is different from the $ ("ancestor descendant"), which selects all descendant elements (including and not limited to the child level)
$ (' prev + next ')
Select the next element immediately after the Prev element
$ (' prev ~ siblings ')
Select the next element after the Prev element

3 Filter Selector

3.1 Basic Filter Selector

$ ("Selector:first")
Select the first element
$ ("Selector:last")
Select the last Element
$ ("Selector:not (Selector2)")
Removes all elements that match a given selector
$ ("Selector:even")
Select all elements of an even number index, starting at 0
$ ("selector:odd")
Select the index is an odd number of all elements, the index starting from 0
$ ("Selector:eq (Index)")
Select an element that is equal to index, and index starts at 0
$ ("SELECTOR:GT (Index)")
Select an element that has an index greater than index and index starts at 0
$ ("Selector:lt (Index)")
Select the element with index less than index and index starts at 0
$ (": Header")
Select all the header elements, such as H1,H2,H3, etc.
$ (": animated")
Select all elements that are currently executing the animation

3.2 Content Filter Selector

$ (": Contains (text)")
Select an element that contains the text content as "text"
$ (": Empty")
Select an empty element that does not contain child elements or text
$ (": Has (Selector2)")
Select the element that contains the element that the selector matches
$ (":p arent")
Select elements that contain child elements or text

3.3 Visibility Filter Selector

$ (": hidden")
Select all elements that are not visible
$ (": visible")
Select all visible elements

3.4 Attribute Filter Selector

$ ("Selector[attribute]")
Select the element that owns this property
$ ("Selector[attribute=value]")
Select the element of value for the property
$ ("Selector[attribute!=value]")
To select an element of the property that is not equal to value
$ ("Selector[attribute^=value]")
Select the element that the value of the property starts with
$ ("Selector[attribute$=value]")
Select the element that ends the value of the property
$ ("Selector[attribute*=value]")
Select the element with value for the property
$ ("Selector[selector2][selectorn]")
The property selector is merged into a composite property selector that satisfies multiple conditions. Zoom out once for each selection, such as $ ("div[id][title$= ' Test '") Select the <div> element that owns the property ID and the property title ends with "test"

3.5 child Element Filter Selector

$ (": Nth-child (index/even/odd/equation)")
Select the index child element or parity element under each parent element, and index is counted from 1
$ ("Selector:first-child")
Select the first child element of each parent element
$ ("Selector:last-child")
Select the last child element of each parent element
$ ("Selector:only-child")
If an element is the only child element in its parent element, it will be matched. If the parent element contains other elements, it will not be matched

3.6 Form Object Properties Filter Selector

$ ("selector:enabled")
Select all available elements
$ ("selector:disabled")
Select all unavailable elements
$ ("selector:checked")
Select All selected elements (Radio,checkbox)
$ ("selector:selected")
Select All selected option elements (select)

4 form selector

$ (": input")
     Select all <input>,<textarea>,< select>,<button> element
$ (": Text")
     Select all single-line text boxes
$ (": Password ")
     Select all Password boxes
$ (": Radio ")
     Select all of the radio boxes
$ (": checkbox")
     Select all check boxes
$ (": Submit")
     Select all Submit Buttons
$ (": Image")
     Select all image buttons
$ (": Reset ")
     Select all the reset buttons
$ (": Button ")
     Select all buttons
$ (": File")
     Select all uploaded fields
$ (": Hidden")

     Select all invisible elements

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.