(1) Basic Object acquisition
$ ("*")
Get all objects
$ ("# Element ")
The object whose id is element is equivalent to document. getElementById ("element ");
$ (". Abc ")
Get the object whose class is abc
$ ("Div ")
Obtain all div elements in html
$ ("# A,. B, p ")
Obtain the element where id is a, class is B, and all p elements.
$ ("# A. B p ")
Obtain the p element of element a with id a and class B.
(2) hierarchical object acquisition
$ ("Div> input ")
Obtain all input objects under the div
$ ("Div + h ")
Obtains an h element following the div.
$ ("Div ~ P ")
Obtain all p elements after the element div
(3) Simple Object acquisition
$ ("Element: first ")
Obtain the first element on the page. For example, $ ("div: frist") indicates the first div.
$ ("Element: last ")
Obtain the last element of a page, for example, $ ("div: frist"), to indicate the last div.
$ ("Element: not (selector )")
Remove all elements that match the selector. For example, $ ("input: not (: check)") indicates all unselected check boxes.
$ ("Element: even ")
Obtains the even number of rows of element elements.
$ ("Element: odd ")
Returns the odd number of rows of an element.
$ ("Element: eq (index )")
Element for retrieving a specific index, for example, $ ("div: el (2)") indicates the third div.
$ ("Element: gt (index )")
Match All elements greater than the given index value
$ ("Element: lt (index )")
Match All elements smaller than the given Index
$ (": Header ")
Matching the Elements marked with h
$ ("Element: animated ")
Match All elements without animation Effects
(4) get content objects and object visibility
$ ("Element: contains (text )")
Whether the text in the element contains a letter or string
$ ("Element: empty ")
Obtains element objects that do not contain text or child elements.
$ ("Element: parent ")
Obtain the object element that contains text or child elements.
$ ("Element: has (selector )")
Matches an element to determine whether it contains an element. For example, $ ("p: has (span)") indicates all p elements containing the span element.
$ ("Element: hidden ")
Matches all invisible elements, including the display: none and the property of input is a hidden element.
$ ("Element: visible ")
Match All courseware Elements
(5) object obtaining advanced
$ ("Element [id]")
Obtain all elements with the id attribute
$ ("Element [attribute = abcd]")
Obtains all elements whose attributes are abcd.
$ ("Element [attribute! = Abcd] ")
Obtain all elements whose attributes are not abcd.
$ ("Element [attribute ^ = AB]")
Obtains all elements whose attributes start with AB.
$ ("Element [attribute $ = AB]")
Obtains all elements whose attributes end with AB.
$ ("Element [attribute * = AB]")
Obtain all elements containing an attribute containing AB.
$ ("Element [selector1] [selector2] [...]")
If the property selector matches $ ("input [id] [name] [value = abcd]"), it indicates that the input element with ID, Name, and value is abcd is obtained.
(6) subelement acquisition
$ ("Element: nth-child (index )")
Select the nth child element under the parent level, and the index starts from 1.
: Nth-child (even) even
: Nth-child (odd) odd
: Nth-child (3n) Expression
: Nth-child (2) Index
: Nth-child (3n + 1) Expression
$ ("Element: first-child ")
The first child element under the parent level
$ ("Element: last-child ")
The last child element under the parent level
$ ("Element: only-child ")
A unique child element under the parent level
(7) Getting form objects
$ (: Input)
Only the input element type can be set to input button select textarea.
$ (: Text)
All text boxes in the current row
$ (: Password)
All password boxes
$ (: Radio)
All radio buttons
$ (: Checkbox)
All check boxes
$ (: Submit)
All submit button
$ (: Image)
All image Domains
$ (: Reset)
All recharge buttons
$ (: Button)
All buttons
$ (: File)
All File Upload Domains
$ (: Hidden)
All invisible elements or elements whose type is hidden
$ (: Enabled)
All available input Elements
$ (: Disabled)
All unavailable input Elements
$ (: Checked)
All check box Elements
$ (: Selected)
All drop-down tables
(8) setting and removing element attributes
$ ("Element"). attr (name)
Obtain the attribute value of the First Matching Element, for example, $ ("img"). attr ("src ");
$ ("Element"). attr ({key: value, key: value ,......})
Set multiple attributes for an element at a time
$ ("Element"). attr (key, value)
Set attributes for an element
$ ("Element"). attr (key, function)
Set a computing attribute for all matching elements
$ ("Element"). removeAttr (name)
Remove an attribute