scrimba
Learn JavaScript
Chrome Extension
Use createElement() and append() instead of innerHTML
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Use createElement() and append() instead of innerHTML
AboutCommentsNotes
Use createElement() and append() instead of innerHTML
Expand for more info
index.js
run
preview
console
let myLeads = ["www.awesomelead.com", "www.epiclead.com", "www.greatlead.com"]
const inputEl = document.getElementById("input-el")
const inputBtn = document.getElementById("input-btn")
const ulEl = document.getElementById("ul-el")

inputBtn.addEventListener("click", function() {
myLeads.push(inputEl.value)
console.log(myLeads)
})

// Let's try a different method!
for (let i = 0; i < myLeads.length; i++) {
ulEl.innerHTML += "<li>" + myLeads[i] + "</li>"
}



Console
/index.html
-3:35