Jquery basics-PHPer Xu Qin-focus on PHP Technology

Source: Internet
Author: User
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

    The first
  • Element
    $ ("Your href00000000'.jpg ']") all attributes with the href attribute ending with ". jpg"
    $ ("P # intro. head") id = "intro"

    All class = "head" elements in the element
    $ (Li [a: contains ('register ')] ") content contains the Register element
    $ ("Input [@ name = bar]") name is of barElement
    $ ("Input [@ type = radio] [@ checked]") type is radioElement
    $ ("Li"). not ("ul") li does not contain node elements of ul nodes
    $ ("Span [@ id]") elements that contain the id attribute
    $ ("[@ Id = span1]") node element whose id is span1

    2. Introduction to Jquery event server

    $ (Selector). click () click event of the selected element
    $ (Selector). dblclick () double-click event of the selected element
    $ (Selector). focus () get focus event of the selected element
    $ (Selector). mouseover () the mouse hover event of the selected element
    Optional (selector).css (); CSS event of the selected element
    $ (Selector). hide (); hidden event of the selected element
    $ (Selector). show ('low'); display event of the selected element

    More php learning> PHPer Xu Qin-focus on PHP technology http://xuqin.blog.51cto.com/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.