DOM is divided into three aspects, namely DOM Core, HTML-DOM, and CSS-DOM.
1. DOM Core is not exclusive to JavaScript. Any programming language that supports DOM can use it.
GetElementById(), getElementsByTagName()... and other methods in JavaScript.
For example: Use DOM Core to get the form object:
document.getElementsByTagName("form");
2, HTML-DOM.
When using JavaScript and DOM to write scripts for HTML files. There are many attributes specific to HTML-DOM. The emergence of HTML-DOM is even more important than DOM Core. Early on, it provides some more concise notations to describe the attributes of various HTML elements.
For example: Use HTML-DOM to get the form object method:
document.forms //HTML-DOM provides a forms Object.
3, CSS-DOM
CSS-DOM is an operation for CSS. The main function of CSS-DOM technology in JavaScript is to obtain and set various attributes of the style object.
For example: How to set the font color of an element's style object: element.style.color="red";
What you will learn below is: DOM operations in jQuery:
First build a DOM tree:
What is your favorite fruit? ?