Conversion between a JQuery object and a DOM object

Source: Internet
Author: User

The jquery object turns into a DOM object:

Two conversions convert a jquery object to a DOM object: [index] and. get (index);

(1) JQuery object is a data object, you can get the corresponding Dom object by means of [index].

such as: Var $v =$ ("#v"); jquery Object

var v= $v [0]; Dom Object

Alert (v.checked)//Detect if this checkbox is selected

(2) jquery itself provides, through the. Get (Index) method, to get the corresponding DOM object

such as: Var $v =$ ("#v"); jquery Object

var v= $v. Get (0); Dom Object

Alert (v.checked)//Detect if this checkbox is selected

The DOM object is turned into a jquery object:

For a DOM object, you can just wrap the DOM object with $ () and you'll get a jquery object. $ (DOM object)

such as: Var V=document.getelementbyid ("V"); Dom Object

var $v =$ (v); jquery Object

After the conversion, you can use the JQuery method arbitrarily.

Conversion between a JQuery object and a DOM object

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.