HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Modify HTML = change elements, attributes, styles and events.
Modify HTML DOM means many different aspects:
In the following sections, we will study in depth the HTML DOM to modify the conventional method.
The easiest way to change the content of the element is to use the innerHTML property.
The following example changes the contents of a HTML <p> element:
We will explain to you the details of the example in the following sections. |
Through the HTML DOM, you can access the object style HTML elements.
The following example to change a HTML paragraph style:
<p id="p2">Hello world!</p>
<script>
document.getElementById("p2").style.color="blue";
</script>
</body>
</html>
To add a new element to the HTML DOM, you must first create the element (an element node), and then append it to the existing elements.