jquery Selector "Summary"

Source: Internet
Author: User

This article summarizes all of the methods associated with the selector in jquery, which allows you to learn all the ways to use selectors in jquery.

One: Basic selector:

$ ("#aijquery") Select the element with ID value equal to Aijquery $("P") Select all p tag element $ (". Aijquery") Select all elements of the CSS using the Aijquery class $ ( "*") Select all the elements in the document, $ ("#aijquery, Div,.angel") federated selection, select the ID aijquery,div tag, and all tags containing the CSS style of Angel

Two: Hierarchy selector:

$ ("div p") Select all p tag elements within the DIV tag includingchild elements of child elements $ ("div > P") Select all P tag child elements in the DIV tag without includingchild elements of child elements $ ("div + P") Select All The P tag element immediately following the div tag ("div ~ P") selects all P tag elements with Div peers

Three: Basic filter:

$ ("Div:first") selects the first $("Div:last") of all DIV elements andselects the last $("Input:not (: Checked)") of all DIV elements Select all unselected input $ ("Tr:even") to select all the TR elements of the 0,2,4 ... The element $ ("tr:odd") selects all the TR elements of the section 1,3,5 ... Element $ ("Td:eq (2)") selects all TD elements with thenumber 2 in theTD element $ ("TD:GT (4)") selects all TD elements in the TD element with an ordinal greater than 4 $ ("TD:LT (4)") Selects all TD elements in the TD element with an ordinal less than 4

Four: Content filter:

$ ("Div:contains (' Aijquery ')") Select all the elements in the div that contain the Aijquery text $ ("Td:empty") Select all the array of TD elements that are empty (also excluding text nodes) $ ( "Div:has (P)") Select all thediv elements containing the P tag $ ("td:parent") Select all the element array with TD as the parent node

Five: Attribute filter:

$ ("Div[id]") Select all the div element containing the id attribute $ ("input[name= ' Aijquery ')" To select all the name attribute equals ' Aijquery ' of the INPUT element $ (" input[name!= ' Aijquery ') Select all the name attribute not equal to ' aijquery ' of the INPUT element $ ("input[name^= ' Aijquery ']") Select all the name attributes to ' Aijquery ' INPUT element starting with $ ("input[name$= ' aijquery ')" selects all of the name attributes with the ' aijquery ' end of the INPUT element $ ("Input[name *= ' Aijquery ') Select all the name attribute containing ' Aijquery ' of the INPUT element $ ("input[id][name$= ' Aijquery ']") Select all elements that contain the id attribute and the Name property ends with Aijquery

Six: Form element selector:

$ (": Input") Select all the form input elements, including input, textarea, select and button $ (": Text") to select all the text INPUT element $ (":p assword" Select all the password input elements $ (": Radio") to select all theradio input elements $(": CheckBox") to select all the checkbox input elements $ ( ": Submit") Select all thesubmit input elements $ (": Image") to select all theimage input elements $ (": Reset") to select all Reset The INPUT element $ (": Button") selects all the button input elements $(": File") to select all the file input elements $ (": Hidden") Select all input elements of type hidden or hidden fields of the form

jquery Selector "Summary"

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.