(i) Understanding of jquery
jquery is a JavaScript library that gets a defined set of methods by encapsulating native JavaScript functions
the main thrust of jquery: Achieve more with less code
(ii) The advantages of jquery
1) The DOM can be accessed and manipulated like CSS
2) Modify CSS Control page appearance
3) Simplified JS code operation
4) Event broker is easier
5) Easy to use animation effect
6) Ajax technology is more perfect
7) A large number of jquery-based plugins
8) can customize the extension function plug-in
(iii) The syntax of jquery
Format: $ (selector). Action ()
Dollar sign $ itself is an abbreviation for jquery objects
Selectors selector querying and finding HTML elements
Action performs an operation on an element
Instance: $ ("P"). Hide (): Hide P element
Here is an online api:http://jquery.cuishifeng.cn/for jquery
(iv) multi-Library conflict
resolve a multi-Library conflict: The Jquery.onconflict () method discards the $ symbol, and you cannot use the $ symbol when you use the JQuery object later, and you want to use jquery
(v) Conversion between a native JS object and a jquery object
JS Object--"jquery object:
var P=document.getelementbyid (' P ');
$ (P);//Convert to jquery object
jquery Object-"JS object:
$ (P). Get (0) or $ (p) [0]//this gets the JS native object.
(vi) DOM operations
1) Set elements and content:
Method Name Description
HTML () Gets the HTML content in the element
HTML (value) to set HTML content in an element
text () Gets the content of the element in Chinese
text (value) to set the element content in Chinese
Val () Gets the text content in the form element
val (value) Gets the text content in the form element
2) Action element Properties// Description: This is an action on a tag element property, not a property in a CSS style sheet
attr (key) Gets the attribute value of the element key property
attr (key,value) sets the attribute value of the element key property
attr ({key1:value1,key2:value2}) sets the attribute value of the element's multiple key property, and the method parameter is an object
attr (key,function (index,value) {}) Set element key via FN
3) Manipulating CSS styles
Method Name Description
CSS ({name1:value1,name2:value2}) set element multiple CSS styles
AddClass (Class) adds a CSS class to each element
AddClass (Class1 class2 class3) Add multiple CSS classes to an element
Remove a CSS class for an element
Removeclass (Class1 class2 class3) deleting elements of multiple CSS classes
Toggleclass (Class) Toggles the default style and the specified style back and forth
Recognize the advantages of jquery,jquery, syntax, multi-Library conflicts, JS native objects and jquery objects between the conversion and DOM operations, common methods