What is a DOM object? HTML organizes documents in a tree structure, as follows:
1-4< /title>
Example
What is your favorite fruit?
HTML above The DOM tree of the file is as follows:
What is a jQuery object?
jQuery object is a DOM object packaged by jQuery, as follows:
$(domObj) is equivalent to document.getElementsByTagName("h3")
$("#ID ") Equivalent to document.getElementsById("ID")
Conversion of jQuery objects and DOM objects? 1. Get the object:
Get the jQuery object: var $variable=jQuery object;
Get the DOM object: var variable=DOM object;
2.jQuery Object to DOM object:
Use array to convert var cr=$("#cr")[0];
Use get(index) method to convert var cr=$("#cr").get (0);
3. DOM object to jQuery object:
var cr=document.getElementsById("cr"); //Get DOM object
var $cr=$(cr);//Conversion as jQuery object