JavaScriptHTML + CSS + JavaScript
Draft saved locallyJavaScript · Spaces: 2
Live preview move your pointer inside
Create HTML from JavaScript
JavaScript can create a new DOM element even when that element was not written in the HTML file.
const item = document.createElement("li");
item.textContent = "New item";At this stage the item exists in memory, but it is not on the page yet.
Learn more
01
Your mission
Create a new list item when the ADD DRAGON function runs.
- Inside
addDragon(), create anliwithdocument.createElement("li")and store it inconst item. - Set
item.textContentto🐲 Fire Dragon. - Do not append it yet; that is the next mission.
Check my work Run project