One: Commonly used selectors:
Basic Selector$ ("#myDiv")//match unique element with this ID value$ ("div")//matches all elements of the specified name$ (". MyClass")//match all elements that have this class style value$ ("*")//Match all elements$( This)//match itself$ ("Div,span,p.myclass")//UNION ALL matching selector Cascade selectors$ ("form input")//descendant selector, select all descendant nodes of ancestor$ ("#main > *")//Child selector, select all child nodes of parent$ ("label + input")//Pro Selector, select the next pro node for prev$ ("#prev ~ div")//Sibling Selector, select all sibling nodes of the Prev
Basic Filter Selector $ ("Tr:first")//match the first selected element$ ("Tr:last")//match the last selected element$ ("Tr:even")//all elements that match even positions in the collection (starting at 0)$ ("tr:odd")//matches all elements of an odd position in the collection (starting at 0)$ ("Td:eq (2)")//matches the element at the specified position in the collection (starting at 0)$ ("div:animated")//match all elements that are running the animationContent Filter Selector $ ("Div:contains (' John ')")//matches all elements that contain the specified text$ ("Td:empty")//matches all empty elements (elements that contain only text are not empty)$ ("Div:has (P)")//matches all elements that contain at least one selector from the original element collection$ ("Div:hidden")//matches all hidden elements, including hidden fields of the form$ ("div:visible")//match all visible elementsProperty Filter Selector $ ("Div[id]")//matches all elements with the specified attribute$ ("Input[name= ' AA ']")//matches all element elements with the specified attribute value$ ("input[name^= ' AA ']")//matches all elements with the specified attribute value beginning with value$ ("input[name$= ' AA ']")//matches all elements with the specified attribute value ending with value$ ("input[name*= ' AA ']")//matches all elements of the specified attribute value that contain the value characterchild element Filter Selector $ ("UL Li:nth-child (n) "),//matches the nth child element of the parent element$ ("div span:first-child")//matches the 1th child element of a parent element$ ("div span:last-child")//matches the last 1 child elements of a parent elementFORM element Selector $ (": input")//matches all form input elements, including all types of input, textarea, select, and button$ (": Text")//match all input elements of type text$ (":p Assword")//match all input elements of type password$ (": Radio")//match all input elements of type radio$ (": checkbox")//match all input elements of type checkbox$ (": Submit")//match all input elements of type submit$ (": Image")//match all input elements of type image$ (": Reset")//match all input elements of type reset$ (": Button")//match all input elements of type button$ (": File")//match all input elements of type file$ (": Hidden")//a hidden field form element filter selector that matches all input elements of type hidden or form$ (": Enabled")//match all of the table cell elements that are operational$ (":d isabled")//match all non-operational table cells$ (": Checked")//match all selected elements
Two: Common methods
//Common Operations. EQ (i)//get the first few elements. Text ()//Gets or sets the element text content. HTML ()//Gets or sets the element HTML code content. Val ()//Gets or sets the form element value. attr ()//Gets or sets the property that applies to the custom property. Removeattr ()//Removing properties from. CSS ()//Gets or sets the style. addclass ()//Set Class. Removeclass ()//Remove Class. Prop ()//action properties, for fixed properties. Trim ()//Remove Spaces//Append Remove. after ();//add content after a matching element. append ();//Insert content as the element's contents behind the element. AppendTo ();//connect elements after content. before ();//contrary to after method. Empty ()//set the content of the element to null. remove ();//Delete all the specified elements//related elements. Filter (expr)//returns an element collection that matches the specified expression. Children ()//Find child elements. Parent ()//find the parent element. Next (expr)//the element behind the sibling element. . Prev (expr)//elements of the preceding sibling element. Find (expr)//searches for all elements that match the specified expression. . Add (HTML)//Append Element//Events. Unbind ("Blur")//Removing events. Bind ("Blur",function(){})//Binding Events. Hover (function(){})//move the mouse over//Animation. Show () shows hidden matching elements: Hide () hides all matching elements: toggle () Toggles the visible state of the element: Slidedown (speed, [callback]) dynamically displays all matching elements by a height change (increase downward). Optionally trigger a callback function after the display is complete. This animation effect only adjusts the height of the element, allowing the matching elements to be displayed in a "Sliding" way: slideup (speed, [callback]) dynamically hides all matching elements through a height change (decrease up), optionally triggering a callback function after the hide is complete. This animation effect only adjusts the height of the element, allowing the matching elements to be hidden in a "sliding" way: slidetoggle (speed, [callback]) toggles the visibility of all matching elements by the height change and optionally triggers a callback function after the switch is complete. This animation effect only adjusts the height of the element, allowing the matching elements to be hidden or displayed as "sliding": fadeIn (speed, [callback]) fades all matching elements by changing the opacity, and optionally triggers a callback function after the animation is complete. This animation only adjusts the opacity of the element, meaning that the height and width of all matched elements do not change. FadeOut (speed, [callback]) fades out all matching elements by changing the opacity, and optionally triggers a callback function after the animation is complete. This animation only adjusts the opacity of the element, meaning that the height and width of all matched elements do not change. FadeTo (speed, opacity, [callback]) progressively adjusts the opacity of all matching elements to the specified opacity, and optionally trigger a callback function after the animation is complete. This animation only adjusts the opacity of the element, meaning that the height and width of all matching elements do not change: Stop () stops all the matching elements that are currently running animation. If there are animations in the queue, they start immediately: queue () gets a reference to the animation sequence of the first matching element (returns an array of functions). Queue (callback) adds an executable function at the end of each event sequence of a matching element. As an event function for this element. Queue (Queue) replaces the original animation sequence of all matching elements with a new animation sequence. Dequeue () Executes and removes animation from the front end of the animation sequence. Animate (params, [duration], [easing], [ Callback]) to create a custom animation function: Animate (params, options) Another way to create a custom animation
jquery element Selection, common methods