0

Create HTML element using JS

Iā€™m wanting to make JS that creates a div tag when it is run Iā€™ve done this a while back but I donā€™t have access to those files

27th Sep 2023, 3:35 PM
Timmothy Rain
Timmothy Rain - avatar
5 Answers
+ 4
Timmothy Rain document.body.append(div);
27th Sep 2023, 4:24 PM
AĶ¢J
AĶ¢J - avatar
+ 4
let div = document.createElement('div');
27th Sep 2023, 3:51 PM
AĶ¢J
AĶ¢J - avatar
+ 3
and if you want it to be displayed, you need to insert it into the DOM
27th Sep 2023, 3:53 PM
Lisa
Lisa - avatar
+ 3
27th Sep 2023, 4:01 PM
Lisa
Lisa - avatar
+ 1
AĶ¢J after creating the element how do i insert it into the html?
27th Sep 2023, 3:55 PM
Timmothy Rain
Timmothy Rain - avatar