-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckout.js
More file actions
56 lines (40 loc) · 1.42 KB
/
Copy pathcheckout.js
File metadata and controls
56 lines (40 loc) · 1.42 KB
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
let data=JSON.parse(localStorage.getItem("cart"))||[];
console.log(data)
data.map(function app(el){
let tr1=document.createElement("tr");
let productimg=document.createElement("img");
productimg.src=el.img;
productimg.setAttribute("class","productimg");
let td2=document.createElement("tb2");
td2.append(productimg);
let name=document.createElement("td");
name.setAttribute("class","name")
name.textContent=el.name;
let price=document.createElement("td");
price.textContent=el.price;
price.setAttribute("class","price");
tr1.append(td2,name,price);
document.querySelector("#tbody").append(tr1);
})
let sum=JSON.parse(localStorage.getItem("sum"));
console.log(sum);
document.querySelector("#price").textContent=`₹ ${sum}`;
document.querySelector("#price1").textContent=`₹ ${sum}`;
// let price1=document.getElementById("price");
// price1.innerText="450"
document.querySelector(".continue").addEventListener("click", function (){
let number=document.getElementById("card_number").value;
number.toString();
let mm=document.getElementById("mm").value;
mm.toString();
let cvv=document.getElementById("cvv").value;
cvv.toString();
if((number==9082106716) &&( mm==1212) && (cvv==123)){
alert("Payment Done")
window.location.href="home.html";
localStorage.removeItem("cart");
}
else{
alert("Wrong details")
}
})