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 Respostas
+ 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