JavaScript objects and jquery objects and Dom objects

Source: Internet
Author: User

Today, the difference and transformation between a JavaScript object and a jquery object and a DOM object has been seen before, but the JavaScript object has been created before

var variable =//This is a JavaScript object

var $variable = $ ()//This is a jquery object

var variable = document.get ...//This is a DOM object, methods include getElementById (), Getelementbytagname () ...

So let's talk about the conversion between them:

The conversion between jquery and JavaScript objects

Conversion between jquery and Dom objects

jquery defines a DOM node as a method that calls the DOM first, and then transforms it into a jquery object

var $li = $ ("<li></li>") equal to the following

var $li = $ (document.createelement ("Li"))

Okay, that's almost it.

So the question arises in the mind, then what about the conversion between the DOM object and the JavaScript object???????

Let's talk about what DOM is for ...

Let's start with a W3 definition:

URL is: http://www.w3.org/TR/DOM-Level-2-Core/introduction.html

If you don't know English, look it up in the dictionary. , it says that the DOM is just an HTML and XML application interface that is used to manipulate nodes (element nodes, text nodes), not a language, just like JSON, which is just a tool.

I think:

It is to find the matching element by providing a method, and then return a corresponding object, typically, like document.getElementById () returns an object, while Document.getelementbytagname (), Document.getelementbyname () returns an array of objects that are loaded in an array. Different language platforms are available for it, which language to use, and which language to return to, which is the object of the language.

JavaScript objects and jquery objects and Dom 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.