Common jquery selector Rollup _jquery

Source: Internet
Author: User

Base element Selector

Copy Code code as follows:

$ ("P")
$ ("P.II") Select all Class=ii p elements
$ ("P#demo") select the first P element of Id=demo

Layered Selector

Copy Code code as follows:

$ ("div input") all input under div
$ ("Div>input")

Basic condition Selector

Copy Code code as follows:

$ ("P:first")
$ ("P:last")
$ ("Tr:even") Select even rows
$ ("tr:odd") odd
$ ("Input:not (: Checked)") Select all elements selected for this selection
$ ("Tr:eq (1)") Table with index value of 1
$ ("tr:gt (0)") greater than 0
$ ("tr:lt (0)") less than 0
$ (": Header") Select All Header elements
$ (": animated") the animation being executed

Content Condition Selector

Copy Code code as follows:

$ ("Div:constains (' ddd ')") Select a layer element that contains DDD text
$ ("Td:empty") Select a table cell that does not contain text or child elements
$ ("Div:has (P)") Select the layer element that contains the paragraph element
$ ("td:parent") Select a table cell that contains child elements or text

Visibility condition Selector

Copy Code code as follows:

$ ("Tr:hidden")//Select all hidden tables
$ ("tr:visible") Select all visible tables

Property Selector

Copy Code code as follows:

$ ("div[id]") Layer with ID attribute
$ ("Input[name= ']") input property name= '
$ ("input[name!= ']")
$ ("input[name^= '") Select the form INPUT element with the Name property and the value "as the starting content"
$ ("input[name$= ']") Select the form INPUT element with the Name property and the value "as End content"
$ ("input[name*= '") select form INPUT element with Name property and value '
$ ("input[id][name$= ']") select an input form element with an ID and name attribute with a value of ' to end content '

Child element Selector

Copy Code code as follows:

$ ("UL Li:nth-child (2)") Select the second list item
$ ("ul Li:nth-child (even)")
$ ("ul Li:nth-child (Odd)")
$ ("ul Li:nth-child (3n)")
$ ("ul Li:first-child")
$ ("ul Li:last-child")
$ ("ul li:only-child") select list appears and only one list item appears

Form element Selector

Copy Code code as follows:

$ ("input") Select all elements such as input textarea Select button
$ (": text") Line of text
$ (":p Assword")
$ (": Radio")
$ (": checkbox")
$ (": Submit")
$ (": Image")
$ (": Reset")
$ (": Button")
$ (": File")
$ (": Hidden")

Form Property Selector

Copy Code code as follows:

$ ("input:enabled")//Select all available
$ ("input:disabled")
$ ("input:checked")
$ ("select:option: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.