-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
59 lines (45 loc) · 1.32 KB
/
script.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
// static data = []
const result = []
new URLSearchParams(window.location.search).forEach((value,name)=>{
result.push(value)
})
// window.location.replace('http://127.0.0.1:5500/');
if(result[0] != undefined && result[0].length != 0 )
{localStorage.setItem(result[0].split(' ').join(''), result)}
const table = document.querySelector(".table1")
keys = Object.keys(localStorage)
const literal = (result) =>{
return `
<td>
<input type="checkbox" id= ${result[0].split(' ').join('')} class= "checkbox">
</td>
<td>
${result[0]}
</td>
<td>
${result[1]}
</td>
<td>
${result[2]}
</td>
`;
};
keys.forEach((item)=>{
temp = localStorage.getItem(item).split(',')
if(item.length != 0){
tr = document.createElement('tr')
tr.id = item.split(' ').join('')
tr.innerHTML = literal(temp)
table.appendChild(tr)}
})
function remove(){
document.querySelectorAll('.checkbox').forEach((checker)=>{
if(checker.checked === true){
localStorage.removeItem(checker.id)
console.log(checker.id)
}
})
window.location.replace('https://ankit5054.github.io/TODO/');
// window.location.replace('http://127.0.0.1:5500/');
// http://127.0.0.1:5500/
}