1 jquery $ (document). Ready (function () {}) can be simply written as $ (function () {}) 2 jquery objects and DOM cannot use each other's methods like ①jquery objects and Dom objects: Jqu The Ery object is converted to a DOM object ①jquery object is a collection of Dom objects, you can get the DOM object within the jquery object by subscript [index], ② can be provided by jquery, $ (' #obj '). Get (Index) Get DOM object ; Two: Dom objects are converted to jquery objects ① use $ (DOM object) to wrap Dom objects together; 3 jquery and other libraries (conflicts) The jquery library imports after other libraries ① can be handed over by Jquery.noconflict () method $ control to other libraries (such as prototype.js), you can use jquery () as a manufacturing plant ② can also customize alternative names: var $j = jquery.noconflict () custom shortcut ③ If you want to use $, while other libraries also use $; A jquery.noconflict ()//Transfer $ symbol control in the outer layer; jquery (function ($) {Continue with $ () method;}) b Jquer Y.noconflict (); (function ($) { pass the $ character as a parameter to the anonymous function}) (jquery); jquery can be used directly before other libraries, without using Jquery.noconfli CT () method; 4 Jquerydom operation ①jquery gets is always the object, if determine whether an element exists cannot use if ($ ("#tt")) {} and to determine the length of the obtained object if ($ ("#tt"). Lengt h>0) {}5 jquery selector contains special symbols ① the selector with a special symbol must use the caret \ \ Eg: Gets the element with the ID of id#b ("#id \ #b") when the element with ID Id[1] is obtained $("#id \\[1\\]") 6 jquery selector with spaces ①var $t _a=$ ('. Test:hidden '); A descendant selector that represents the hidden element inside the element of the selection class as Test ②var $t _b=$ ('. Test:hidden '); The filter selector indicates that the hidden class test element is selected, and that the PS (: Contains (") selector detects the contents of the filter element, as long as it contains the matched content is selected, as long as I have, as long as you want;; The selected element still conforms to the rule with a space 7:last:last-child①:last gets the last element in the matching collection ②:last-child if there is only one parent element for all elements in the matching collection, the same as: last, or a collection of child elements of several parent elements: Last-child selected as Child element is the last element collection of the parent element
Sharp jquery-Selector