Added second element (h3), changed way of appending

appendChild can only append one element, append on the other hand takes a list of elements
This commit is contained in:
NetMan 2024-01-06 22:24:34 +01:00
parent 513f36c6a1
commit 43278d20b2
1 changed files with 5 additions and 1 deletions

View File

@ -10,4 +10,8 @@ const p1 = document.createElement('p');
p1.style.color = "#f00"; p1.style.color = "#f00";
p1.textContent = "Hey I'm red!"; p1.textContent = "Hey I'm red!";
container.appendChild(p1); const h3 = document.createElement('h3');
h3.style.color = "#00f";
h3.textContent = "I'm a blue h3!";
container.append(p1, h3);