First, the main points elaborated
1,jquery was created in January 2006 as an open source project, emphasizing the concept of "write Less,domore", compressed size around 30KB. 、
The methods in 2,jquery are set by the design process to automatically manipulate objects, rather than individual objects.
The 3,jq object is an array-like object that is produced after the JQ wrapper over the DOM object, and can be turned into a DOM object using the [0] or get (0) method.
Ii. conflict Resolution of jquery and other JS libraries
// the JQ library needs to be called noconflict () before other libraries are imported Mode 1 (jQuery instead of $): Jquery.noconflict () ; // Give control of the $ to other libraries. jQuery (function () {...}); Mode 2 ($XHH instead of $):var $xhh = jquery.noconflict (); $xhh (function () {...}); Mode 3 (still in $): Jquery.noconflict (); JQuery (function ($) {...}); Mode 4 (still in $): jquery.noconflict ();(function ($) { $ (function () {...});}) {jQuery}; // The JQ Library is imported after other libraries, with jquery instead ofjquery (function () {...});
Third, jquery selector
1, basic selector and Hierarchy selector
//Basic Selector$("#id")$(". ClassName")$("P")$("*")//Select All$("#id,. Classname,p")//Select multiple//Hierarchy Selector$("Div span")//all span descendants of a DIV$("Div>span")//Sub-element span of Div$("Div+span")//equivalent to $ ("div"). Next ("span")$("Div~span")//equivalent to $ ("div"). Nextall ("span"), note the distinction. Siblings ()
2, filter Selector
//Basic Filtration: First/:last//equivalent to: eq (0)/:eq (len-1): Not (selector)/: Has (selector): even/: Odd:eq (Index)/:GT (Index)/:LT (index)//Index starting from 0//child element Filtering: Nth-child (index/even/odd): first-child/:last-child:only-child//select its unique child element//Content Filtering: Contains ("XXX")//elements that contain text content with "XXX": empty/:p Arent//That includes child elements, excluding child elements.//Expression Filtering: Header//H1,h2,h3 ... Label: Animated:focus//the element that currently gets the focus: Hidden//including <input type= "hidden", "Display:none", "Visibility:hidden": Visible//attribute FilteringDiv[id] div[class=classname]div[class!=Classname]div[title^=value]//Div with property starting with valueDiv[title$=value]//attribute div with value endDiv[title*=value]//div with value in attributeDiv[attribute1][attribute2] ...//Multiple attribute Filters
3, form selector and corresponding filter
form selector : input // elements of all forms, including Input,select,button ... // Select a table cell for the type attribute : Text:password:radio:checkbox:submit:image:reset:button:file:hidden // A special choice is to include all the invisible elements outside the form Form filtering : Enabled/:d isabled:checked: Selected
4,jq commonly used methods of selection
Filter (selector) // filtering itself find (selector) // filter in Descendants
"Learning Notes" sharp jquery (a) selector