Dom Objects and jquery objects

Source: Internet
Author: User

Dom:document Object Model

jquery object: The object that is produced after the DOM object is wrapped by jquery, the jquery object can use the method in jquery and cannot use any method of the DOM object.

Conversion of jquery objects and Dom objects

1. jquery converted to DOM object

var $variable =jquery Object

Var Variable=dom object

jquery provides two ways of [index] and get (index)

var $cc =$ ("#cc");

var cc= $cc [0]/$cc. Get (0);

2. Dom converted to jquery object

var Cc=document.getelementbyid ("CC");

var $cc =$ (CC);

<!--Dom Way to determine--  <script type= "Text/javascript" >//$ (function () {//var cc=$ ("#cc") [0];//$ ("#cc"). Click (function () {//if (cc.checked)//{//Alert ("Completed,thank You"),//}//else//{//alert ("Please read the details car Efully ")///}//});</script><!--jquery way to determine--><script type=" text/javascript ">$ (function () {$ ("#cc"). Click (function () {var $cc =$ ("#cc"), if ($cc. Is (": Checked")) {alert ("Jquery:completed,thank You");} Else{alert ("Jquery:please read the details carefully");}) </script>

  

        <div>   <input type= "checkbox" id= "cc"/>   <label for= "CC" >i has read the above Terms</label ></div>

Resolve JQuery and other library conflicts: Jquery.noconflict () function to give control of variable $ to other JavaScript libraries

Dom Objects and jquery objects

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.