About jquery.

Source: Internet
Author: User

Version 1.4.2.

Download http://www.jquery.com

 

Let me talk about use often of jquery's methods.

 

Core ..

1. jquery (arguments [0], arguments [1]); <br/> find arguments [0] In arbuments [1]. like. jquery ("TR", "table"); </P> <p> 2. jquery (element (s); <br/> conversion a object to jquery object. like jquery (document. body); </P> <p> 3. jquery (string); <br/> by the String Conversion a string to a jquery object. like jquery ("body ");

 

 

Bind event ..

 

1. <br/> $ ("TR", $ ("table ")). each (<br/> $ (this ). live ("hover", function () {<br/> $ (this ). toggleclass ("C"); <br/>}); </P> <p>); </P> <p> 2. <br/> $ ("table "). each (<br/> $ ("TR", this ). live ("hover", function () {<br/> $ (this ). toggleclass ("C"); <br/>}); </P> <p>); </P> <p> 3. <br/> $ ("table "). find ("TR "). each (function () {<br/> $ (this ). hover (function () {<br/> $ (this ). toggleclass ("C"); <br/>}); </P> <p> 4. <br/> execute one time. <br/> $ ("body "). one ("click", function {}{}); </P> <p> 5. $ ("table "). delegate ("TD", "hover", function () {<br/> $ (this ). toggleclass ("C"); <br/>}); </P> <p> Find object... <br/> 1. find by ID. <br/> $ ("# ID"); </P> <p> 2. find the tr child elements of table. <br/> $ ("table "). find ("TR"); </P> <p> 3. find the first tr child element of table. <br/> $ ("table "). find ("TR: eq (0 )"). or $ ("table "). ("TR: First"); </P> <p> 4. find the tr parent element of table. <br/> $ ("TR: parent ");

 

 

Attributes...

 

1. find a div which has ID attributes. <br/> $ ("Div [ID = 1]"). id equals 1. </P> <p> $ ("Div [name = big]"). name equals big.

 

 

Form...

 

1. find a input which type is radio. <br/> $ (": input [type = radio]"); </P> <p> 1. find all checkboxes which it was be checked. <br/> $ ("input: checked ");

 

CSS...

 

1. change style by CSS method. <br/> $ ("Div "). find ("span [ID = CSS]" ground .css ("background-color", "Red"); </P> <p> 2. change style by styling. <br/> $ ("Div "). addclass ("seleted"); </P> <p> 3. remove style. <br/> $ ("Div "). removeclass (); or $ ("Div "). removeclass ("seleted ");

 

Ajax ..

 

1. get method <br/> $. get (URL, {}, callback (RDATA) {}); </P> <p> 2. POST method <br/> $. post (URL, {}, callback (RDATA) {}); </P> <p> 3. return JSON data method <br/> $. getjson (URL, {}, callback (RDATA) {}); <br/>

 

 

Plugin...

 

 

(Function ($) {}) (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.