Dom Object
In traditional JavaScript development, we are often the first to get DOM objects, such as:
document.getElementById ("Dv1");
We often use the getElementById method to get DOM objects. In the event trigger function, we can also get the reference event trigger object through this. Or, We can also get the DOM object that raised the event by Event.target or Event.srcelement.
Note that here we get all the DOM objects.
jquery Package Set
The jquery wrapper set can be said to be an extension of the DOM object. In the world of jquery, all objects, whether one or a group, are encapsulated into a jquery package set.
For example, get a jquery package set that contains an element:
var jqueryobject = $ ("#dv1");
The jquery wrapper set is called together as an object, and the jquery wrapper has a rich set of properties and methods that are unique to jquery.
Conversion of Dom objects to jquery objects
(1) Dom object converted to jquery wrapper set
Way One// use the function provided by jquery Yvar Jqueryobject = $ ("#dv1");//Method two// first Get DOM object// and then use the function provided by jquery to wrap var dom_dv1 = document.getElementById ("Dv1"); var jQueryObject2 = $ (DOM_DV1);
(2) jquery wrapper set converted to DOM object
Execute the following code:
var jqueryobject = $ ("#dv1");d Ebugger;
In the process of debugging, we look at jqueryobject[0], we will find that the ID of this property is Dv1, is exactly what we need DOM object
Defining the concepts of DOM objects and jquery packaging sets will speed up our learning and avoid detours.
Dom objects and jquery wrapper sets