120 hours of 1200 days. net (8) about JQuery, 1200 hours of jquery
Anonymous functions are particularly important.
1. jQuery is a number of functions written in js syntax. It is still implemented in js internally, so it is not a substitute for js. Using jQuery code, the jQuery extension plug-in still requires js technology. jq itself is a bunch of js functions; write less do more
2. To use jq, you must use the $ object. Jq methods can be called only when common dom is encapsulated as a jq object.
$ Is short for jq, and jQuery can be used in the code instead of $
3. write comments. There will be more and more jq code in the future. comments are necessary.
4. The common version of the jq file is for development and use, and the compressed version is for release.
5. dom objects can be converted to jq objects, and jq objects can also be converted to dom objects $ (dom objects)
6. onload is executed after all the page content is loaded.
Ready indicates that the basic tab of the page is loaded and executed.
Generally, $ (function () {***}) is used (){***});
7. We recommend that you use each to Traverse Key-value pairs and map to traverse arrays.
8. The trim method is available.
9. dom attributes are generally changed to methods in jq.
10,
// Multi-condition Selector
$ ('P, # dv,. cls ')
// Layered Selector
$ ('Div p'developer.css ()
The child element p and the child element p both change.
$ ('Div> p'hangzhou.css pair <strong> <p> </strong> invalid pair <p> </p>
// The sibling element p directly under the layer takes effect.
$ ('Div + p ')
$ ('Div-p') // All p labels behind the layer take effect (brothers) the nephew does not take effect
<Div> </div>
<P> </p>
<P> </p>
<Span> <p> </span> /// invalid
11,
Users ('div'{.next().css () // obtain the first sibling element after the current element
. NextAll () // all the directly following elements. The child layer elements do not include (but include p nested p)
. Prev () The first sibling element before the current element
. PrevAll ();
. Siblings: All sibling elements of the current element, including the grandson Element
**************
$ ('P'). length Determines whether an element exists
************
Add class style
$ ('Div '). addClass ('cls') class is not added
Remove Class Style
$ ('Div '). removeClass ('cls ')
***********
$ (Body). toggleClass (cls); Switch whether there is a cls style (such as video switch light)
12,
$ ('P eq(2w.'hangzhou.css () // obtain the element based on the index (subscript)
$ ('P lt(2}'}.css () // two elements whose index is less than 2
$ ('P gt(2}'}.css () // The element whose index is greater than 2
13,
// Basic filter Selector
$ ('Div: first ')
$ ('Div '). first ()
$ ('Div: la ')
$ ('Div '). last ()
$ ('Div: even') The index is an even number.
$ ('Div: odd') with an odd Index
14,
Code for star rating:
$ (Function (){
$ ('# Tb td'). mouseover (function (){
$ (This). text ('solid start'). prevAll (). text ('solid start ');
}). Mouseout (function (){
$ (This). text ('hollow start'). siblings ();
});
});