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:
parent
513f36c6a1
commit
43278d20b2
6
index.js
6
index.js
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue