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
5 Answers
+ 4
Timmothy Rain
document.body.append(div);
+ 4
let div = document.createElement('div');
+ 3
and if you want it to be displayed, you need to insert it into the DOM
+ 3
just like in the example in the documentation
https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
+ 1
AĶ¢J after creating the element how do i insert it into the html?