jquery element Selection, common methods
One: The commonly used selector:
Base Selector $ ("#myDiv")//Match unique element $ ("div") with this ID value///Match all elements of the specified name $ (". MyClass")//Match all elements with this class style value $ ("*")//Match all elements $ (this)//horse With its own $ ("Div,span,p.myclass")//UNION ALL matching selector Cascade selector $ ("form input")//descendant selector, select all Descendants node of ancestor $ ("#main > *")//child selector, Select all child nodes of Parent $ ("label + input")//Pro selector, select Prev Next pro node $ ("#prev ~ div")//Sibling selector, select prev for all sibling nodes basic filter selector $ ("Tr:first")//Match First A selected element $ ("tr:last")//Match the last selected element $ ("Tr:even")///Match all elements of an even position in the collection (starting from 0) $ ("tr:odd")//matching all elements of the odd position in the collection (starting from 0) $ ("Td:eq" (2) ")//matches the element at the specified position in the collection (starting at 0) $ (" div:animated ")//matches all animations that are running element content Filter Selector $ (" Div:contains (' John ') ")//Match all elements containing the specified text $ (" TD: Empty ")//matches all empty elements (elements that contain only text that are not empty) $ (" Div:has (P) ")//matches all elements (" Div:hidden ") of at least one selector from the original element collection again//matches all hidden elements. Also includes hidden fields of the form $ ("div:visible")//matching all visible element attributes filter Selector $ ("div[id]")//Match all elements with the specified attribute $ ("input[name= ' AA ')")//Match all element elements with the specified property value $ ( "Input[name^= ' AA ']"//matches element $ ("input[name$= ' AA ') that begins with value of all specified property values"//matches the element $ ("input[name*= ' AA ') ending with value of all specified property values"// Matches the element child element filter Selector $ ("ul Li:nth-child (N)") of all specified attribute values containing the value character,//matches the parent elementThe nth child element $ ("div span:first-child")//matching the 1th element of the parent element $ ("div span:last-child")//matching the last 1 child elements of the parent element form element Selector $ (": input")// Match all form input elements, including all types of input, textarea, select and button $ (": Text")//Match INPUT element of all type text $ (":p assword")// Match all input elements of type password $ (": Radio")//Match all input elements of type radio $ (": checkbox")//Match INPUT element $ (": Submit") of all types as checkbox// Match all input elements of type Submit $ (": Image")//Match INPUT element of all type image $ (": RESET")//Match INPUT element of all type Reset $ (": Button")// Match INPUT element $ (": File") with all Type button//Match INPUT element $ (": hidden") of all type file///Match hidden field form element Filter selector of all type hidden input elements or forms $ (":
Enabled ")//Match all operable form elements $ (":d isabled ")//Match all non-operational form elements $ (": 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 ()//Get or set the form element value. attr ()//Get or set properties for custom properties . REMOVEATTR ()//Remove attributes. CSS ()//Get or set style. AddClass ()//Set class. Removeclass ()//Remove class. Prop ()//action properties, for fixed properties. Trim ()//Remove Empty Lattice//Append removal. After (); Add content after the matching element. Append (); Inserts content as an element into the back of the element. Appendto (); Connect the elements after the content. before (); Contrary to the After method. Empty ()//Set the content of the element to null. Remove (); Deletes all the specified elements//related elements. Filter (expr)//Returns a collection of elements that match the specified expression. Children ()//Find the child element. Parent ()//To find the elements of the parent element. Next (expr)//behind sibling elements ... prev (expr)//elements of the preceding sibling element. Find (expr)//search for all elements that match the specified expression.. Add (HTML)//APPEND elements//events. Unbind ("blur")//Remove event. Bind ("Blur", function () {})//binding event. Hover (function () {})//mouse over//animation. Show () shows hidden matching elements ... hide () hides all matching elements ... toggle () Toggle the visible state of the element ... Slidedown (SPE Ed, [callback]) dynamically displays all matching elements by changing the height (increasing downward), optionally triggering a callback function after the display is complete. This animation effect only adjusts the height of the elements, allowing the matching elements to be displayed in a "sliding" way. Slideup (speed, [callback]) dynamically hides all matching elements by changing height (up), and optionally triggers a callback function after the shadowing is complete. This animation effect only adjusts the height of the elements, allowing the matching elements to be hidden in a "sliding" manner. Slidetoggle (speed, [callBack]) Toggles the visibility of all matching elements by changing the height, and optionally triggers a callback function after the switch completes. This animation effect adjusts only the height of the elements, allowing the matching elements to be hidden or displayed in a "sliding" way. FadeIn (speed, [callback]) implements the fade effect of all matching elements through opacity changes and optionally triggers a callback function after the animation completes. This animation only adjusts the opacity of the element, which means that the height and width of all matching elements do not change. Fadeout (speed, [callback]) implements the fade effect of all matching elements through opacity changes and optionally triggers a callback function after the animation completes. This animation only adjusts the opacity of the element, which means that the height and width of all matching elements do not change. Fadeto (speed, opacity, [callback]) adjusts the opacity of all matching elements incrementally to the specified opacity. and optionally triggers a callback function after the animation completes. This animation only adjusts the opacity of the element, which means that the height and width of all matching elements do not change. Stop () stops the animation that all matching elements are currently running. If there are animations in the queue, they start right away. 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 the sequence of events for each matching element. The 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 the animation from the front of the animation sequence. Animate (params, [duration], [easing], [cal
Lback]) is used to create custom animation functions. animate (params, options) Another way to create a custom animation
Thank you for reading, I hope to help you, thank you for your support for this site!