Create HTML with JS | createElement()

Опубликовано: 19 Октябрь 2024
на канале: Angela Design
55,605
1.7k

In this video I go over how to create HTML with JavaScript. I show you how to add an EventListener to a button that will call a function. I go over how to use createElement() to make a div in the HTML, how to add a class to these new divs and alternate styles.

Codepen: https://codepen.io/angeladelise/pen/x...

In this video I show you:
0:29 - Starting Code
1:38 - Variables in JavaScript
2:31 - Add an EventListener to the HTML Button
3:10 - AddNew Div function
3:23 - How to use createElement
4:18 - How to use appendChild to the body
5:01 - How to add a class to the newDiv
6:41 - How to place the newDivs in a particular container
8:19 - How to make the newDivs flow horizontally
9:23 - How to alternate div styles with :nth-child

Want to improve designer to development handoff? View my Sketch to Zeplin workflow here: https://www.youtube.com/watch?v=D3ZF2...

#htmlcssjs #jstutorial #createelement

Let's Connect
Dribbble: https://dribbble.com/angeladelise
Blog:   / angeladelise