The DOM object and the jquery object are always confused at first. Now make a summary of this:
DOM object: Document Object model. Each DOM can be seen as a tree. Like Ul,li ol DL P H1 and so on are DOM element nodes. These element nodes can be obtained through JS's getElementsByTagName and getElementById. Dom elements like this are DOM objects.
DOM objects can use the methods in JavaScript. Such as:
var domobj = document.getElementById ("id");
var objhtml = domobj.innerhtml;
The jquery object is the object that is generated after wrapping the DOM object through jquery.
jquery objects can use the methods in jquery. Such as:
$ ("#foo"). html ();
This code is equivalent to document.getElementById ("foo"). InnerHTML;
Of course, jquery objects and Dom objects can be converted to each other:
jquery provides two ways to convert a jquery object into a DOM object: [index] and get (index)
var $CR = $ ("#cr"); jquery Object
var cr = document.getElementById ("Cr"); Dom Object
Now convert them to each other:
To convert a jquery object into a DOM object:
var $CR = $ ("#cr");
var cr = $CR [0]; Converts a jquery object into a DOM object.
To convert a DOM object into a jquery object:
var cr = document.getElementById ("Cr"); The DOM object is declared
var $CR = $ (CR); Convert a DOM object to a jquery object
It is usually the case that jquery does not encapsulate the method you want, but when you have to use a DOM object, you need to convert the jquery object into a DOM object.
Conversion of Dom objects to jquery objects