1. Some methods of the core of jquery
Each (callback) ' is like a loop
$ ("Element"). Length; ' The number of elements, is a property
$ ("Element"). Size (); ' is also the number of elements, but parentheses are a method
$ ("Element"). get (); ' A collection of elements in a page, stored as an array
$ ("Element"). Get (index); ' function is the same as above, index denotes the number of elements, the subscript of the array
$ ("Element"). Get (). reverse (); ' Put the resulting array direction
$ ("Element1"). Index ($ ("Element2")); The index value of element 2 in element 1 is.
2. Basic object Acquisition (note that the jquery object is captured here instead of the DOM object Oh, but they can be converted)
$ ("*") ' means get all objects but I haven't used them so far.
$ ("#XXX") ' Get id=xxx element object (ID can be tag ID or CSS style id) commonly used
$ ("Input[name= ' username ')") gets the element object of the input tag name= ' username ' commonly used
$ (". ABC") ' Get style class ' is the name of the. ABC element object commonly used
$ ("div") ' tag Selector selects all div elements commonly used
$ ("#a,. B,span") ' means that the ID is an element of a and the element that uses class style B and all the SPAN elements
$ ("#a. B p") ' ID number is a and all P elements with B-style are used
3. Level element Acquisition
$ ("Element1 Element2 Element3 ....") ' Before the parent is a subset
$ ("div > P") ' gets all the P elements below the div
$ ("div + P") ' the first P element behind the DIV element
$ ("div ~ p") ' div ' all the p elements behind
4. Simple Object Acquisition
$ ("Element:first") ' The first element of a class element in an HTML page
$ ("element:last") ' The last element of a class element in an HTML page
$ ("Element:not (selector)") ' Removes all elements that match a given selector, such as: $ ("Input:not (: Checked)") to select all unchecked check boxes
$ ("Element:even") ' Get even line '
$ ("element:odd") ' Get Odd line '
$ ("Element:eq (Index)") ' gets a given index value
$ ("ELEMENT:GT (Index)") ' all elements after the element that obtained the given index value
$ ("Element:lt (Index)") ' all elements before the element that gets the given index value
5. Acquisition of Content objects and object visibility
$ ("Element:contains (text)") ' element contains text content
$ (' Element:empty ") ' Gets the element that does not contain child elements or text
$ ("element:partnt") ' Gets the element that contains the child element or text
$ ("Element:has (selector)") ' contains an element, such as: $ ("P:has (span)") that represents all P elements that contain a SPAN element
$ ("Element:hidden") ' Select all visible elements
$ ("element:visible") ' Select all invisible elements
6. Other object acquisition methods
$ ("Element[id]") ' all elements with an id attribute
$ ("Element[attribute = Youlika]" ' gets all elements of a property that are Youlika
$ ("Element[attribute! = Youlika]" ' gets all elements of a property that are not Youlika
$ ("Element[attribute ^= Youlika]" ' gets all elements that have a property that is not the beginning of the Youlika
$ ("Element[attribute $= Youlika]" ' gets all elements that have a property that is not the end of the Youlika
$ ("Element[attribute *= Youlika]" ' gets all elements of a property that contain the beginning of the Youlika
$ ("element[selector1][selector2][....]") ' Conforming to the attribute selector, such as $ ("Input[id][name][value=youlika]"), indicates that an INPUT element with an ID, name, and value of Youlika is obtained.
7. Acquisition of child elements
$ ("Element:nth-child (Index)") ' Select the nth element below the parent
$ ("Element:nth-child (even)") ' Select the even number under the parent
$ ("Element:nth-child (Odd)") ' Select the odd number under the parent
$ ("Element:nth-child (3n+1)") ' Expression
$ ("Element:first-child") ' Select the first child element under the parent
$ ("Element:last-child") ' Select the last child element under the parent
$ ("Element:only-child") ' matches only one child element under the parent, for example DT is unique in the DL list, then the DT is selected
8. Form Object Acquisition
$ (: Input)//Find all of the input elements, including, of course, drop-down lists, text fields, radio boxes, checkboxes, and so on.
$ (: Text)//Match all single-line text boxes
$ (:p assword)//Match all password boxes
$ (: Radio)//Match all the radio buttons
$ (: checkbox)//Match all check boxes
$ (: Submit)//Match all the Submit buttons
$ (: image)//Match all the image fields, for example
$ (: RESET)//Match all the reset buttons
$ (: button)//Match all the buttons
$ (: file)//Match all file upload domains
$ (: Hidden)//match all invisible elements or elements of type hidden
$ (: Enabled)//matches all available input elements, such as radio:enabled to match all available radio buttons
$ (:d isabled)//Match all the unavailable input elements, acting on opposite
$ (: Checked)//Match all selected check box elements
$ (: Selected)//Match all drop-down lists
9. Setting and removing element attributes
$ ("Element"). attr (name) ' Gets the first matching property value, such as $ ("img"). attr ("src")
$ ("element". attr (Key,value) ') ' an element setting property
$ ("Element". attr ({key:value,key1:value,....})) ' Set multiple properties for an element at once
$ ("element"). attr (key,function) ' Sets a computed property value for all matching elements.
$ ("Element"). Removeattr (name)//Remove a property
How JQuery gets objects