Classification of DOM operations: DOM CORE (core), HTML-DOM and CSS-DOM
1. DOM Core
DOM Core is not exclusive to javascript, any programming that supports DOM Any language can use it.
Its use is not limited to processing web pages, but can also be used to process any document written in a markup language, such as XML.
getElementById(), getElementByTagName() in Javascript , getAttribute() and setAttribute() methods are both components of dom core.
2. HTML_DOM
Using HTML_DOM to get the form object
Document.forms
Using HTML_DOM to get the src attribute of an element
Element.src
3. CSS_DOM
CSS_DOM is an operation for CSS. In JavaScript, the main function of CSS-DOM technology is to obtain and set various attributes of the style object. By changing various attributes of the style object, the web page can present various effects.
Element.style.color = “red”;
As a javascript library, jQuery inherits and develops the characteristics of javascript for operating DOM objects, allowing developers to conveniently operate DOM objects.
jQuery’s DOM operation methods include creating, copying, reorganizing, and modifying elements. The following example is fully usable, each line is commented, please copy the code and run it.