Jquery basic learning notes-PHPer Xu Qin-focus on PHP technology jQuery is a JavaScript function library. The jQuery library contains the following features: & nbsp; HTML element selection & nbsp; HTML element Operations & nbsp; CSS Operations & nbsp; HT jquery basic learning notes-PHPer Xu Qin-focus on PHP Technology
JQuery is a JavaScript function library.
The jQuery library has the following features:
HTML element selection
HTML element operations
CSS operations
HTML event functions
JavaScript effects and animation
Html dom traversal and modification
AJAX asynchronous, interactive JavaScript and XML methods
Utilities utility
The jQuery syntax is compiled for the selection of HTML elements. you can perform some operations on the elements. $ (Selector). action ();
JQuery selector:
JQuery element selector: for example, $ ("p # demo") selects the first one of id = "demo ".
Element.
JQuery property selector: for example, $ ("[href?='.jpg ']") selects all elements whose href value ends 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 (); then replace $ with jq
If you want to execute a statement after an animation function, 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.
Using jQuery AJAX and HTTP Get and HTTP Post, you can request TXT, HTML, XML, or JSON from a remote server.
1. Jquery selector usage
$ (This) current element
$ ("P") all
Element
$ ("Input") all input elements
$ (". Intro") all class = "intro" elements
$ ("P. intro") all class = "intro"
Element
$ ("# Intro") id = "intro" first element
$ ("Ul> li") all li nodes under ul
$ ("Ul li: first") each