-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscriptFinal.js
32 lines (25 loc) · 978 Bytes
/
scriptFinal.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
console.log(localStorage.getItem("recipe"));
var recipes = JSON.parse(localStorage.getItem("recipe"));
var looper;
if(recipes.length != 0){
for(looper of recipes){
var element = document.createElement("button");
var lb = document.createElement("br");
element.setAttribute("class", "button button1");
element.innerHTML = looper["name"];
element.setAttribute("onclick", "window.open(\'" + looper["link"] + "\',\'_blank\')");
var abc= document.getElementById("r");
abc.appendChild(element);
abc.append(lb);
}
}else{
var element = document.createElement("button");
var lb = document.createElement("br");
element.setAttribute("class", "button button1");
element.innerHTML = "Bruh you can't make anything out of these... Here's the solution to that...";
element.setAttribute("onclick", "window.open(\'http:\\\\zomato.com\',\'_blank\')");
var abc= document.getElementById("r");
abc.appendChild(element);
abc.append(lb);
}
localStorage.removeItem("recipe");