jquery Object Selection Detailed description

Source: Internet
Author: User

$("*")

represents getting all the objects

$ ("#element")

equivalent to document.getElementById ("element");

$ (". ABC")

means to get all the elements in HTML that use the style ABC.

$ ("div")

represents getting all the DIV elements in the HTML

$ ("#a,. B,p")

represents an element that obtains an ID of a and an element that uses class style B and all P elements

$ ("#a. B P")

represents all of the P elements in a B element that have a class style that is contained
by an element with the ID of a.

$ ("Element1 Element2 Element3 Element ...")

CSS defines hierarchical elements in a way that requires only a space between different elements, the former parent and so on.

$ ("div > Input")


Represents the get div under all input.

$ ("div + P")


Represents an element that matches the p immediately after the DIV element

$ ("div ~ P")


Represents all P elements that match the DIV element

$ ("Element:first")

get the first of an element in an HTML page, such as $ ("Div:first") to get the first Div

$ ("Element:last")

get the last of an element in an HTML page, such as $ ("Div:last") to get the last div

$ ("Element:not (selector)")

removes all elements that match a given selector, such as $ ("Input:not (: Checked)") to select all unchecked checkboxes

$ ("Element:even")

get even lines, counting starting from 0

$ ("element:odd")

get odd lines, counting starting from 0

$ ("Element:eq (Index)")

an element that matches a given index value, starting with a count of 0, such as $ ("Div:eq (3)") to get the 4th div in the HTML

$ ("ELEMENT:GT (Index)")

matches all elements that are greater than the given index value, starting with a count of 0, such as $ ("P:GT (3)") to get the peso 3 that is the 4th P start, then all P

$ ("Element:lt (Index)")

matches all elements that are less than the given index value, starting with a count of 0, such as $ ("P:lt (3)") to get the peso 3 that is the 3rd P start, before all P

$ (": Header")

Match H1,h2,h3 ... Elements such as headings

$ ("element:animated")

match all the elements that are not in the animation effect (about the animation effect, in the following, it is just a mention, do not have to care, do not understand it does not matter)

$ ("Element:contains (text)")

matches whether the text in an element object contains a letter or a string (string) is a finite sequence of 0 or more characters. )

$ ("Element:empty")

Get object element does not contain text or child elements

$ ("element:parent")

In contrast to the above, get an object element that contains text or child elements

$ ("Element:has (selector)")

matches whether an element contains an element such as $ ("P:has (span)") representing all p elements that contain a SPAN element

$ ("Element:hidden")

matching all the invisible elements, including the Display:none and input properties, is hidden can be matched.

$ ("element:visible")

In contrast to the above, all visible elements are matched

jquery Object Selection Detailed description

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.