Sharp jquery (1) Conversion of--dom objects to jquery objects

Source: Internet
Author: User

1. Understanding jquery
    1. DOM object: The Document Object model
    2. jquery object: An object that is produced after wrapping a DOM object through jquery. This is unique to jquery objects, where you cannot use any of the DOM object's methods in a JQuery object, and the DOM object cannot use the jquery object. (This is the one I often mix when I write code)
    3. The interchange of Dom objects and jquery objects: typically preceded by a jquery object with $
      • The jquery object is converted into a DOM object:
        • The jquery object is an array-like object that can be obtained by using the [index] method of the corresponding DOM object
          The code is as follows  var $CR = $ ("#cr");  jquery Object  var cr = $CR [0];        Dom Object
        • Another method is provided by jquery itself, which obtains the corresponding DOM object through the Get (Idnex) method
          The code is as follows  var $CR = $ ("#cr");  jquery Object  var cr = $cr. get[0];        Dom Object
      • Dom object converted to jquery object
        • For DOM objects, you only need to wrap the object in $ () to get a jquery object.
          The code is as follows  var cr = document.getElementById ("Cr");  Dom Object  var $CR = $ (CR);        jquery Object

Sharp jquery (1) Conversion of--dom objects to jquery objects

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.