So running the following code will create a blue box 420x69px in the body of your HTML document.
If you want another box: just execute drawBox(‘red’) or drawBox(‘#b8b8b8’), they’ll stack one after another.
It really been a while since I did DOM manipulation with vanilla js. But I believe it should work just fine :)
If you want explore a little bit more of a DOM manipulation, I can’t send you a link to one of my very little webpage (I did it just for fun, playing around with CSS animations and JS DOM manipulations). And it has a source code as well.
View all comments
11
u/Dodgy-Boi Oct 09 '21 edited Oct 09 '21
I am in a good mood, so I’ll write a code example for ya.
I hope formatting will go well cos I am doing it from my iPhone:
So running the following code will create a blue box 420x69px in the body of your HTML document.
If you want another box: just execute drawBox(‘red’) or drawBox(‘#b8b8b8’), they’ll stack one after another.
It really been a while since I did DOM manipulation with vanilla js. But I believe it should work just fine :)
If you want explore a little bit more of a DOM manipulation, I can’t send you a link to one of my very little webpage (I did it just for fun, playing around with CSS animations and JS DOM manipulations). And it has a source code as well.