DEV Community

SILAMBARASAN A
SILAMBARASAN A

Posted on

Dom

Today I learned how to use JavaScript DOM to dynamically create and control HTML elements.
In this session, I practiced:
Creating HTML elements using document.createElement()
Adding attributes using setAttribute()
Adding text/content using innerText
Changing styles like color and background color using element.style
Appending elements to the DOM using appendChild()
Using DOM, we can create HTML tags without writing them in HTML, modify them using JavaScript, and display them on the webpage dynamically.
This helps in building interactive and dynamic web pages.

Top comments (0)