A concise summary of the jquery selector (including usage examples, at a glance) _jquery

Source: Internet
Author: User

This article now makes a summary of all known jquery selectors, and has a profound and skilful grasp of these selectors, which helps us write various jquery effects quickly! Here's a list of all the options for jquery! Because of the simplicity of jquery usage, there are no more examples to deepen the understanding.

selector instance Select
* $ ("#item *") Select the id attribute to all elements under item
#ID $ ("#lastname") id= elements of "LastName"
. class $ (". Intro") All elements of the class= "Intro"
Element $ ("P") All <p> elements
. class. class $ (". Intro.demo") All class= "Intro" and Class= "demo" Elements
: A $ ("P:first") First <p> Element
: Last $ ("P:last") Last <p> Element
: Even $ ("Tr:even") All even <tr> elements
: Odd $ ("tr:odd") All odd <tr> elements
: Next $ ('. Item '). Next (' div ') Class is the next div sibling element for item, equivalent to $ ('. Item + div ')
:p Rev $ ('. Item '). prev (' div ') Class is the last div sibling element for item
: Nextall $ ('. Item '). Nextall (' div ') Class is all the div sibling elements after item, equivalent to $ ('. Inside ~ Div ')
:p arent > Child $ (' div > span ') Select the first generation span element under the Div, also known as the direct child element
:p arent $ ('. Item:parent ') Select the parent element of the element with class as item
: eq (index) $ ("UL Li:eq (3)") Fourth element in the list (index starting from 0)
: GT (no) $ ("UL li:gt (3)") List elements with index greater than 3
: LT (no) $ ("UL Li:lt (3)") List elements with index less than 3
: Not (selector) $ ("Input:not (: Empty)") $ ("Input:not (. Must)") All input elements that are not empty; elements that are not must for all class attributes
: Header $ (": Header") All header elements
: Animated All animation elements
: Contains (text) $ ("Div:contains (' www.phpernote.com ')") All elements that contain www.phpernote.com strings in all DIV elements
: Empty $ (". Item:empty") All elements of a child (element) node in the element of item for all class attributes
: Hidden $ ("P:hidden") All the hidden <p> elements
: Has $ ('. Item:has (span) ') All elements of the item that have the class attribute contain spans (whether direct or not)
: Visible $ ("table:visible") All visible Tables
S1,s2,s3 $ ("Th,td,.intro") All elements with a matching selection
[attribute] $ ("a[href]") All a-label elements with href attributes
[attribute=value] $ ("[href= ' # ']") The value of all href attributes equals the element of "#"
[attribute!=value] $ ("[href!= ' # ']") The value of all HREF attributes is not equal to the element of "#"
[attribute$=value] $ ("[href$= '. jpg ']") The value of all HREF attributes contains elements that end with ". jpg"
: input $ (": input") All <input> elements
: Text $ (": Text") <input> Elements of all type= "text"
:p Assword $ (":p Assword") <input> Elements of all type= "password"
: Radio $ (": Radio") <input> Elements of all type= "Radio"
: checkbox $ (": checkbox") <input> Elements for all type= "checkbox"
: Submit $ (": Submit") All type= "Submit" <input> elements
: RESET $ (": Reset") <input> Elements of all type= "reset"
: button $ (": Button") <input> Elements of all type= "button"
: Image $ (": Image") <input> Elements of all type= "image"
: File $ (": File") <input> Elements of all type= "file"
: Enabled $ (": Enabled") All active input elements
:d isabled $ (":d isabled") All disabled input elements
: Selected $ (": Selected") All selected input elements
: Checked $ (": Checked") All the input elements that are selected

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.