Skip to main content
100%

Creating new div element with Javascript Only

✓ Published1🌍 Public
NNita
Last edited Feb 8, 2024
Created on Feb 8, 2024
Forked from HTML Starter

This example demonstrates how to create and insert a new HTML element using only JavaScript. It creates a div, sets its text content to “Hello HTML,” and appends it to the document body. The code uses the native DOM APIs `document.createElement`, `textContent`, and `appendChild`. A CSS rule styles all div elements with a 40-pixel font size, making the output visually distinct. No external libraries or data sources are used.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes