-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathotp.js
More file actions
27 lines (25 loc) · 983 Bytes
/
otp.js
File metadata and controls
27 lines (25 loc) · 983 Bytes
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
document.querySelector("#submit").addEventListener("click",placeOrder);
document.querySelector("input+p").addEventListener("click",resendOTP);
let cartArr = JSON.parse(localStorage.getItem('cartData')) || []
function resendOTP(){
// window.addEventListener("load",function(){
// console.log(document.querySelector("#otP").value)
window.location.reload();
alert("One-time Password(OTP) is Sending to your registered mobile number!")
// });
}
function placeOrder(){
let Otp=document.querySelector("#otP").value;
// if(Otp==null){
// // alert("Order Placed Successfully!, Thank You.");
// }
if(Otp==123){
alert("Order Placed Successfully ! Thank You.");
cartArr=[]
localStorage.setItem("cartData",JSON.stringify(cartArr))
window.location.href="index.html"
}else if(Otp!=123){
alert("Entered Wrong One-time Password (OTP) !")
document.querySelector("#otP").value="";
}
}