Before the discussion, make a pact to define the style of the variable.
If the object being obtained is a jquery object, add $ before the variable, for example:
var $variable = jquery object;
If you get a DOM object, it is defined as follows:
var variable = dom object;
The jquery object cannot use the methods in the DOM, but if you are unfamiliar with the methods provided by the JQuery object, or if jquery does not encapsulate the method you want, there are two ways to do this when you have to work with DOM objects. jquery provides two ways to convert a jquery object into a DOM object, which is [index] and get (index).
1, jquery object is an array object, you can get the corresponding Dom object by means of [index].
var $CR = $ ("#cr"); jquery object var cr = $CR [0]//dom Object Alert (cr.checked)//Detect if the checkbox is selected
2. Get the corresponding Dom object by the Get (index) method.
var $CR = $ ("#cr"), var cr = $cr. Get (0); alert (cr.checked) ;
For a DOM object, you simply wrap the DOM object with $ (), and you can get a jquery object in the form of $ (DOM object).
var cr = document.getElementById ("Cr"); Dom object var $CR = $ (CR);
In this summary note:
The Get method in the jquery method is actually getting the DOM element ($ (this). Get (0) with $ (this) [0])
In the jquery method, the EQ, first, last, and so on are all returned jquery objects.
Dom objects can use methods in the DOM, and jquery objects cannot use the methods in the DOM. The jquery object provides a more complete set of tools for manipulating the DOM.
Distinguishing between jquery objects and Dom objects