"Sharp jquery" reading Essentials notes

Source: Internet
Author: User

1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTML>3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />5 <title></title>6 <!--Introducing JQuery -7 <Scriptsrc=".. /scripts/jquery.js "type= "Text/javascript"></Script>8 <Scripttype= "Text/javascript">9 //wait for the DOM element to finish loading.Ten $ (document). Ready (function(){ One Alert ("Hello world!"); A }); - </Script> - </Head> the <Body> - </Body> - </HTML>

jquery's chained style of operation

The difference between a jquery object and a DOM object: The jquery object is the object that is produced after wrapping the DOM object, and the methods of the two cannot be used. But the two objects can be converted to each other, first of all agreed to define the style of the variable, for jquery object variable before adding $, such as:

var $variable =jquery object. If the DOM object, the Var Variable=dom object.

Use the [index] method and the Get (index) method to turn the JQuery object into a DOM object: Var $cr =$ ("#cr"),->var cr= $cr [0], or var cr= $cr. Get (0); Wrapping a DOM object in $ () becomes a jquery object.

Case Study (forum registration), Dom mode:

1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTML>3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />5 <title>1-6-2</title>6 <!--Introducing JQuery -7 <Scriptsrc=".. /.. /scripts/jquery.js "type= "Text/javascript"></Script>8 <Scripttype= "Text/javascript">9 //wait for the DOM element to finish loading.Ten $ (document). Ready (function(){ One     var$CR= $("#cr"); //jquery Object A     varCR=$cr. Get (0); //Dom object, getting $CR [0] - $CR. Click (function(){ -         if(cr.checked) {//Dom Way to judge the Alert ("Thank you for your support! You can continue!"); -         } -     }) - }); + </Script> - </Head> + <Body> A <inputtype= "checkbox"ID= "Cr"/> <label for= "Cr">I have read the above system.</label> at </Body> - </HTML>

jquery Method:

1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTML>3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />5 <title>1-6-1</title>6 <!--Introducing JQuery -7 <Scriptsrc=".. /.. /scripts/jquery.js "type= "Text/javascript"></Script>8 <Scripttype= "Text/javascript">9 //wait for the DOM element to finish loading.Ten $ (document). Ready (function(){ One     var$CR= $("#cr"); //jquery Object A $CR. Click (function(){ -         if($CR. Is (": Checked")){ //The jquery way of judging, is (": Checked") is a method in jquery, to determine whether the jquery object is selected - Alert ("Thank you for your support! You can continue! "); the         } -     }) - }); - </Script> + </Head> - <Body> + <inputtype= "checkbox"ID= "Cr"/><label for= "Cr">I have read the above system.</label> A </Body> at </HTML>

"Sharp jquery" reading Essentials notes

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.