jquery Basic Learning Notes-phper Xuchen-Focus on PHP technology

Source: Internet
Author: User
Tags jquery library
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/

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.