Javascript examples for DOM HTML Element:Div
Dom Manipulation - altering the DOM, create div element, add class and set text content
<html> <head></head> <body> <script> document.addEventListener('DOMContentLoaded', function() { const container = document.querySelector('#container'); const content = document.createElement('div'); content.classList.add('content'); content.textContent = 'Dom text-content!'; container.appendChild(content);//from ww w . j a va2 s . c om }, false); </script> <h1> test test test</h1> <div id="container"></div> </body> </html>