-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecipes.js
38 lines (29 loc) · 808 Bytes
/
recipes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const recipes = {
"recipe": "Lentil Soup",
"ingredients": [
{
"ingredient": "Onion",
"amount": "Whole Chopped Onion"
},
{
"ingredient": "Red Lentils",
"amount": "Half a bag"
}
]
}
/*
const recipesBox = document.getElementById("recipes");
for (let i = 0; i < recipes.ingredients.length; i ++) {
const div = document.createElement("div");
div.innerHTML = recipes[i].ingredient;
recipesBox.appendChild(div);
}
*/
document.getElementById("button").addEventListener("click", function(){
const para = document.createElement("p");
para.innerText = "This is a recipe";
document.body.appendChild(para);
});
document.getElementById("boxButton").addEventListener("click", function(){
document.getElementById("box").style.backgroundColor = "blue";
});