forked from akhilgonde/Pepper-Fry-Clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extra.js
60 lines (53 loc) · 1.44 KB
/
extra.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
document.getElementById("S&R").addEventListener("click",()=>
{
let x= "sofaAndRecliners";
localStorage.setItem("pageInfo",x);
window.location.href="productList.html";
})
document.getElementById("Mchairs").addEventListener("click",()=>
{
let x= "Chairs";
localStorage.setItem("pageInfo",x);
window.location.href="productList.html";
})
document.getElementById("Mbed").addEventListener("click",()=>
{
let x= "bed";
localStorage.setItem("pageInfo",x);
window.location.href="productList.html";
})
document.getElementById("Mdining").addEventListener("click",()=>
{
let x= "dining";
localStorage.setItem("pageInfo",x);
window.location.href="productList.html";
})
document.getElementById("S&R1").addEventListener("click",()=>
{
let x= "sofaAndRecliners";
localStorage.setItem("pageInfo",x);
window.location.href="productList.html";
})
document.getElementById("MBed1").addEventListener("click",()=>
{
let x= "bed";
localStorage.setItem("pageInfo",x);
window.location.href="productList.html";
})
let input=document.getElementById("search");
input.addEventListener("keypress",()=>{
searchData(event);
})
const searchData=(e)=>
{
if(e.keyCode==13)
{
let inp=input.value;
var filterData=wholeData.filter(function(item){
return item.name.includes(inp);
})
localStorage.setItem("searchArr",JSON.stringify(filterData));
// appendDatabase(filterData,"right");
window.location.href="productList.html";
}
}