Jquery core methods
$ ("Element"). length; 'number of elements, which is an attribute
$ ("Element"). Size (); 'is also the number of elements, but parentheses are a method.
$ ("Element"). Get (); 'a collection of elements on the page, stored in Arrays
$ ("Element"). Get (INDEX); 'is the same as above. index indicates the elements and subscript of the array.
$ ("Element"). Get (). Reverse (); 'indicates the direction of the obtained array.
$ ("Element1"). Index ($ ("element2"); 'the index value of element 2 in element 1 is...
, Basic object acquisition
(Note that all jquery objects are obtained here instead of DOM objects, but they can be converted)
$ ("*") 'Indicates getting all objects, but I have never used it like this.
$ ("# XXX") 'obtain the Element Object ID = xxx (ID can be the tag ID or CSS style ID)
$ ("Input [name = 'username']") obtain the Element Object Name = 'username' in the input tag.
$ (". ABC") 'to obtain the style class name is. ABC element object commonly used
$ ("Div") 'tag selector Selects all DIV elements commonly used
$ ("# A,. B, span") 'indicates the element whose ID is A, the element that uses Class B, and all span elements.
$ ("# A. B p") 'id is a and all P elements in the B style are used.
, Hierarchical Element Acquisition
$("Element1 element2 element3...") 'the front parent level is followed by a subset
$ ("Div> P") 'gets all P elements under the div.
$ ("Div + P") the first P element after the DIV Element
$ ("Div ~ P ") All P elements behind 'div
, Simple object acquisition
$ ("Element: First") 'First element of a certain element in the HTML page
$ ("Element: Last") the last element of a certain element in the HTML page
$ ("Element: Not (selector)") 'removes all elements that match the given selector, for example: $ ("input: Not (: checked )") indicates Selecting All unselected check boxes.
$ ("Element: Even") 'returns an even number of rows.
$ ("Element: odd") 'returns an odd number of rows.
$ ("Element: eq (INDEX)") 'gets a given index value
$ ("Element: GT (INDEX)") All elements after obtaining the element of the given index value
$ ("Element: Lt (INDEX)") 'gets all elements before the element of the given index value
, Content Object acquisition and object visibility
$ ("Element: Contains (text)") 'indicates whether the element contains text content.
$ ('Element: empty ") 'gets
$ ("Element: partnt") 'obtains
$ ("Element: Has (selector)") 'indicates whether an element exists. For example, $ ("P: Has (SPAN)") indicates all P elements containing the span element.
$ ("Element: hidden") 'select all visible elements
$ ("Element: visible") 'select all invisible elements
Other Object acquisition methods
$ ("Element [ID]") 'all elements with the ID attribute
$ ("Element [attribute = youlika]" 'obtains all elements whose attributes are youlika.
$ ("Element [attribute! = Youlika] "'Get all elements whose property is not youlika
$ ("Element [attribute ^ = youlika]" 'obtains all elements whose attributes start with not youlika.
$ ("Element [attribute $ = youlika]" 'obtains all elements whose attributes are not the end of youlika.
$ ("Element [attribute * = youlika]" 'obtains all elements whose attributes start with youlika.
$ ("Element [selector1] [selector2] [...] ") 'matches the property selector. For example, $ (" input [ID] [name] [value = youlika] ") indicates that the input element with ID, name, and value is youlika is obtained.
, Sub-element acquisition
$ ("Element: Nth-child (INDEX)") 'select the nth element under the parent level
$ ("Element: Nth-child (even)") 'select an even number under the parent level
$ ("Element: Nth-child (ODD)") 'select the odd number under the parent level
$ ("Element: Nth-child (3N + 1)") 'expression
$ ("Element: First-Child") 'selects the first child element under the parent level.
$ ("Element: Last-Child") 'selects the last child element under the parent level.
$ ("Element: Only-Child") 'matches a unique child element under the parent level. For example, if dt is unique in the DL list, DT is selected.
, Form object acquisition
$ (: Input) // query all input elements, including the drop-down list, text field, single-statement, and check box.
$ (: Text) // match all single-row text boxes
$ (: Password) // match all password boxes
$ (: Radio) // match all radio buttons
$ (: Checkbox) // match all check boxes
$ (: Submit) // match all the submit buttons
$ (: Image) // match all image fields, for example, <input type = "image"/>
$ (: Reset) // match all reset buttons
$ (: Button) // match all buttons
$ (: File) // match all file upload Domains
$ (: Hidden) // matches all the invisible elements or elements whose type is hidden.
$ (: Enabled) // match all available input elements. For example, radio: enabled indicates matching all available single-choice buttons.
$ (: Disabled) // matches all the unavailable input elements, which act in the opposite way.
$ (: Checked) // match all checked check box Elements
$ (: Selected) // match all the drop-down lists
Setting and removing element attributes
$ ("Element"). ATTR (name) 'gets the first matching property value, for example, $ ("IMG"). ATTR ("src ")
$ ("Element". ATTR (Key, value) ") 'specifies the attribute of an element.
$ ("Element". ATTR ({key: value, key1: value,...}) 'sets multiple attributes for an element at a time.
$ ("Element"). ATTR (Key, function) 'sets a calculated attribute value for all matching elements.
$ ("Element"). removeattr (name) // remove a genus