0

How can i create many html elements and control its property by js

22nd Apr 2019, 10:05 PM
YosefRM🇪🇬
YosefRM🇪🇬 - avatar
5 Réponses
+ 17
let container = document.getElementById("container"); for(let i = 0; i < 10; i++){ let newEl = document.createElement("p"); newEl.innerHTML = `i am paragraph #${i + 1}`; container.appendChild(newEl); }
23rd Apr 2019, 5:36 AM
Burey
Burey - avatar
0
I want to repeat the same element by js instead of write it in html a lot of times
22nd Apr 2019, 10:18 PM
YosefRM🇪🇬
YosefRM🇪🇬 - avatar