-
Notifications
You must be signed in to change notification settings - Fork 1
/
cart.js
63 lines (41 loc) · 1.98 KB
/
cart.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
let arrOfData = JSON.parse(localStorage.getItem("courses")) || [];
let data = document.getElementById("products_data");
function display(arrOfData){
arrOfData.forEach(function(el){
let div = document.createElement("div");
div.setAttribute("id","dividerJS")
let img = document.createElement("img");
img.setAttribute("id","imaOne");
img.src = el.img
// console.log(img.src)
let name = document.createElement("h2")
name.innerText = el.name
// let rating = document.createElement("p")
// rating.innerText = el.rating
// let duration = document.createElement("p")
// duration.innerText = el.duration
let price = document.createElement("h3")
price.innerText = "₹"+el.price
let a = parseInt(price);
let total = document.getElementById("total");
total.innerText = "Total price: - ₹"+el.price
// let DIV=document.createElement("div")
// DIV.setAttribute("id","DIV")
// let p = document.createElement("p")
// p.innerText = el.p
// p.setAttribute("id","explore")
// let btn = document.createElement("button")
// btn.innerText = "Buy Now"
// btn.setAttribute("id","btn");
// btn.addEventListener("click",function(){
// addeData(el);
// })
// DIV.append(p,btn)
div.append(img,name,price)
data.append(div)
})
}
display(arrOfData);
function checkout(){
alert("Order Placed Successfully", window.location = "home.html")
}