I. What is jquery
<1> jquery, created by American John Resig, has attracted many JavaScript gurus from around the world to join its team.
<2>jquery is another excellent JavaScript framework following prototype. Its purpose is--write Less,do more!
<3> It is a lightweight JS library (only 21k after compression), this is not the other JS library, it is compatible with CSS3, but also compatible with a variety of browsers
<4>jquery is a fast, concise JavaScript library that makes it easier for users to handle htmldocuments, events, animate, and easily provide Ajax interactivity to websites.
<5>jquery also has a big advantage is that its documentation is full, and the various applications are very detailed, while there are many mature plug-ins to choose from.
Two. What is a jquery object?
The jquery object is the object that is generated after wrapping the DOM object through jquery. jquery objects are unique to jquery . if an object is a jquery object , then it can use the method in jquery : $ ( "#test"). html ();
$ ("#test"). HTML () //means: Gets the HTML code within the element with ID test. where HTML () is the method in jquery //This code is equivalent to using the DOM implementation code: document.getElementById ("Test"). InnerHTML; Although jquery objects are created after wrapping a DOM object, jquery cannot use any of the methods of the DOM object, nor does the DOM object use the methods in JQuery. Random use will error //convention: If you get a JQuery object, Then add $ to the variable before it. var $variable = jQuery Object var variable = Dom Object $variable[0]:jquery object converted to DOM object $ ("#msg"). html (); $ ("#msg") [0].innerhtml
Basic syntax for jquery:$ (selector). Action ()
Three. Search for elements (selectors and filters)
3.1 Selector
3.1.1 Basic Selector
$ ("*") $ ("#id") $ (". Class") $ ("element") $ (" . Class,p,div")
3.1.2 Hierarchy Selector
$ (". Outer div") $ (". Outer>div") $ (". Oute+div") $ ( ". outer~div")
3.1.3 Basic Selector
$ ("Li:first") $ (" Li:eq (2)") $ ("Li:even") $ ( "LI:GT (1)")
3.1.4 Property Selector
$ ("[id= ' Div1 ']") $ ("[' Alex ' = ' sb '][id]")
3.1.5 Form Selector
$ ("[type= ' text ']")------->$ (": Text") note applies to the input tag: $ ("input:checked")
The left menu of the instance (note: a reference to thejquery version )
<! DOCTYPE html>3.2 Filters
3.2.1 Filter Filter
3.2.2 Find Filters
Web Chapter---JQuery