"JQuery" selector

Source: Internet
Author: User

"JQuery" selector

Information: W3school http://www.w3school.com.cn/jquery/jquery_ref_selectors.asp

1. Tag Selector: $ ("P")--all P tags

2. ID Selector: $ ("#txtid")--id = txtid Element

3. Class Selector: $ (". Pclass")--class = Pclass element

4. Property Selector: $ ("[href= ' lnk ']")--href = lnk element

Selector
SelectorExample Select
* $("*") All elements
#ID $ ("#id") id= "id" lookup
. class $ (". Intro") class= Elements of "Intro"
Element $ ("P") All <p> elements
. class. class $ (". Intro.demo") All class= "Intro" and Class= "demo" Elements
This $ (This) Their own
: First $ ("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
: 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)") All input elements that are not empty
: Header $ (": Header") All heading elements
: Animated All animated elements
: Contains (text) $ (": Contains (' W3school ')") All elements containing the specified string
: Empty $ (": Empty") All elements with No child (element) nodes
: Hidden $ ("P:hidden") All hidden <p> elements
: Visible $ ("table:visible") All the visible tables
S1,s2,s3 $ ("Th,td,.intro") All elements with a matching selection
[attribute] $ ("[href]") All elements with an HREF attribute
[attribute=value] $ ("[href= ' # ']") The value of all href attributes equals "#" elements
[attribute! =value] $ ("[href!= ' # ']") The value of all HREF attributes is not equal to the "#" element
[attribute$=value] $ ("[href$= '. jpg ']") The value of all HREF attributes contains elements ending with ". jpg"
: input $ (": input") All <input> elements
: Text $ (": Text") All <input> elements of type= "text"
:p Assword $ (":p Assword") All <input> elements of type= "password"
: Radio $ (":Radio") All <input> elements of type= "Radio"
: checkbox $ (": checkbox") All <input> elements of the type= "checkbox"
: Submit $ (": Submit") All <input> elements of type= "submit"
: RESET $ (": Reset") All <input> elements of type= "reset"
: button $ (": Button") All <input> elements of type= "button"
: Image $ (": Image") All <input> elements of type= "image"
: File $ (": File") All <input> elements of type= "file"
: Enabled $ (": Enabled") All the active input elements
:d isabled $ (":d isabled") All disabled input elements
: Selected $ (": Selected") All selected input elements
: Checked $ (": Checked") All selected input elements

"JQuery" selector

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.