A quick review of jquery

Source: Internet
Author: User

Jquery

What is Jquery?jquery is a JavaScript library that greatly simplifies JavaScript programming.
The next step is to discuss how to use this library.
Because this is a library, the first thing to do is to introduce a library

<type= "Text/javascript"  src= "Jquery.js"></ Script >


The JQuery section is written in the packaging code.

 <  script  type  = "Text/javascript"  >  $ (document). Ready ( function   () { /*  ** Code section *  */  function   () {});  </ script  >  

jquery syntax: This is simple. $ (selector). Action ();

jquery selector: Use $ as a selector, $ ("P") $ ("P.class-name") to select a <p> with class= "Class-name"

$ ("[href]") all elements with href attribute $ ("[foo=" value "]") $ ("[foo!= ' value ']") $ ([foo$= ". jpg"]) ending with. jpg


jquery event: With the click Time Example,

$ ("button"). Click (function () {});

Other common events include the following: Dbclick focus mouseover ............;

jquery effect: Take hide () for example:
$ ("Div1"). Hide ();//Parameter optional, (speed,callback) Speed:slow fast or milliseconds
Others are Hide () show () toggle () FadeIn () FadeOut () Fadetoggle () FadeTo (Speed,opacity,callback)
The Slideup () slide effect is an element that appears and hides Slidedown () Slidetoggle () and so on;
There is also animate (), which has the animate parameters ({CSS attribute color: "Red"},speed,callback), and the Stop () method to stop the animation and the effect process.
The callback function is used to execute after a smooth execution of the method.

jquery obtains content and properties: Text () Gets or sets the text HTML () Gets or sets the HTML code val () Gets or sets the value method of the form element;
Gets or sets the property attr (), attr ("Property name": "attribute value");

jquery add element: Append () The end of the selected element, Prepend () before the beginning of the selected element after () before ()
Append () and prepend () after () before () can receive many newelements

jquery Delete element: Remove () deletes the selected element, empty () deletes the child elements of the selected element;

jquery operation CSS AddClass () removeclass () Toggleclass () CSS () CSS ("propertyname") returns CSS property values
CSS ("Propetyname", "value") set CSS properties;

jquery Size: Width () Set value use integer to Height () innerwidth () innerheight () Outerwidth (True) Outerheight (True)

jquery Traversal: Parent () Direct parent Element parents () All parent elements can add parameters to search Parentuntil ("element signature") between two elements
Children (), returns all the immediate child elements that can be searched using the parameter search find () to return all descendants.
Siblings () all fellow elements next () Nextall () Nextuntil () prev () Prevall () prevuntil () section can be searched using parameters
First () selected element last () eq () selects an element with an index number the filter parameter is the selector not () opposite the filter

The JQuery ajax:get (Url,callback) callback function has 2 parameters for the first receive ResponseText second receive status.
Post (Url,data,callback)

The JQuery noconflict () method is used to replace the selector. var jq=$.noconflict ();

A quick review of jquery

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.