The difference between a DOM object and a JS object and a jquery object
One, Dom object
The Document Object model, referred to as DOM, is the standard programming interface recommended by the Organization for the processing of extensible superscript languages.
- The DOM is actually a document model that is described in an object-oriented manner. The DOM defines the objects that are required to represent and modify the document, the behavior and properties of those objects, and the relationships between those objects.
- Through the DOM, you can access all the HTML elements, along with the text and attributes they contain. You can modify and delete the content, and you can also create new elements. Html
- The DOM is independent of the platform and programming language. It can be used by any programming language such as Java, JavaScript, and VBScript.
- Dom objects, which are the objects we get with traditional methods (JavaScript).
- The DOM is exactly a normative standard (Document Object model) for document objects, and the standard defines only properties and method behavior. Second, JavaScript objects
- JavaScript provides multiple built-in objects, such as String, Date, Array, and so on.
- Objects are just special data types with properties and methods.
- The DOM object obtained by JS is the JS object.
- When the browser supports JS DOM interface (API), here the narrow Dom object is in the form of a JS object, that is, a JS object
Third, jquery object
The jquery object is actually an array of JavaScript, which contains 125 methods and 4 properties
4 properties, respectively, are
- jquery Current jquery Framework version number
- Length indicates the number of elements of the array object.
- The context is generally directed to the HTMLDocument object.
- Selector passed in selector content
The jquery object is the object that is generated after wrapping the DOM object through jquery. jquery objects are unique to jquery and can be used in jquery, but not in the DOM, which in turn cannot be used by the DOM object.
The jquery object differs from the JS object:
1.jQuery object belongs to JS array;
2.jQuery objects are generated after a DOM object wrapped in jquery;
3.jQuery objects cannot use methods and properties of DOM objects
4.DOM objects cannot use the methods and properties of jquery objects
- Mutual conversions between jquery objects and JS objects
1) JS to jquery object:
$ (JS object)
2) JQuery object to JS object
Example:
Convert a jquery object to a DOM object
Doc2.innerhtml= "This is the first DOM object of jquery"
Use the Get function provided by the JQuery object itself to return the DOM object at the specified collection location
var doc2=$ ("#idDoc2"). Get (0);
Doc2.innerhtml= "This is the second DOM object of jquery"
The difference between a DOM object and a JS object and a jquery object