jquery Basic Learning Note-phper Xuchen-Focus on PHP technology
JQuery is a library of JavaScript functions.
The JQuery library contains the following features:
HTML element Selection
HTML element manipulation
CSS actions
HTML Event functions
JavaScript Effects and animations
HTML DOM Traversal and modification
AJAX asynchronous, interactive JavaScript, and XML methods
Utilities Practical Tools
The jQuery syntax is for the selection of HTML elements, and you can perform certain operations on elements. $ (selector). Action ();
JQuery selector:
JQuery element selector: For example: $ ("P#demo") Select the first id= "demo"
Elements.
JQuery Property Selector: For example: $ ("[href$= '. jpg ']") selects all elements with an href value ending with ". jpg".
JQuery CSS selector: for example: $ ("P"). CSS ("Background-color", "Red"); change the background color of all p elements to red.
jquery name conflict; If there is a name conflict, rename the jquery library: Var jq=jquery.noconflict () and replace $ with JQ
If you want to execute the statement after a function that involves animation, use the callback function.
$ ("P"). Hide (1000,function () {
Alert ("The paragraph is now hidden");
});
JQuery provides a rich library of functions (methods) for AJAX development.
With JQuery AJAX, you can request TXT, HTML, XML, or JSON from a remote server using HTTP Get and HTTP Post.
1. Various uses of jquery selector
$ (This) current element
$ ("P") all
Elements
$ ("input") all input elements
$ (". Intro") All Elements of class= "Intro"
$ ("P.intro") All class= "Intro"
Elements
$ ("#intro") id= the first element of "intro"
$ ("ul > Li") under UL for all LI nodes
$ ("ul Li:first") each
The first
- element of the
$ ("[href$=. jpg]") all the classes with an HREF attribute that ends with ". jpg"
$ ("Div#intro. Head") id= the Elements of "intro" = element of "head"
$ (li[a:contains (' Register ')]) content contains the element of Register
$ ("input[@name =bar]") name is the element of bar
$ (" input[@type =radio][@checked]) type is the element
$ ("Li") of radio. Not ("ul") Li under the node element containing the UL node
$ ("span[@id]") The element
$ ("[@id =span1]") that contains the id attribute is the node element with ID span1
2, Introduction to the jquery event
$ (selector). Click event of selected Element
$ (selector). DblClick () The double-click event of the selected element
$ (selector). focus () The Focusable event of the selected element
$ (selector). MouseOver () the mouse hover event of the selected element
$ ( selector). CSS (); The CSS event of the selected element
$ (selector). Hide (); hidden event
$ (selector) of the selected element. Show (' slow '); Display events for selected elements
more PHP learning >> Phper Xuchen-Focus on PHP technology http://xuqin.blog.51cto.com/
-