Converting between JavaScript and jquery __javascript

Source: Internet
Author: User
Dom object: A DOM element object obtained by the traditional JS method; jquery object: A new object generated after wrapping the original DOM object through the jquery method.
<script type= "Text/javascript" >
        $ (function () {
            //***** Dom object converted to jquery object *****//
            //dom object
            var ObjDom0 = document.getElementById ("Div0");
            Convert to jquery object
            var $obj 0 = $ (objDom0);
            Call the method in jquery to set the content
            $obj 0.html ("content set after the DOM object is converted to a jquery object");

            The jquery object is turned into a DOM object *****//
            //jquery object
            var $obj 1 = $ ("#div1");
            Convert to Dom object
            var objDom1 =  $obj 1[0];//or $obj1.get (0);
            Call object method in JavaScript set content
            objdom1.innerhtml = "content to be set after the JQuery object has been converted to a DOM object";
        }
    </script >
Related Article

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.