jquery objects converted to DOM objects
jquery provides two ways to convert a jquery object into a DOM object, which is [index] and get (index). Some people might find it strange, how to use subscript, yes, the jquery object is an array object.
The following code shows a way to convert a jquery object into a DOM object and then use the DOM object
Copy the code code as follows:
var $cr =$ ("#cr"); jquery Object
var cr = $CR [0]; Dom objects can also be written as Var cr= $cr. Get (0);
alert (cr.checked); Detects if the checkbox is selected
Dom objects converted into jquery objects
For a DOM object, you simply wrap the DOM object with $ () and you can get a jquery object by $ (DOM object);
Copy the code code as follows:
var Cr=document.getelementbyid ("Cr"); Dom Object
var $CR = $ (CR); Convert to jquery Object
The method of jquery can be used arbitrarily after the conversion.
jquery objects go to DOM, Dom to jquery