-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (20 loc) · 765 Bytes
/
script.js
File metadata and controls
23 lines (20 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
console.log("working")
document.querySelector(".btn").addEventListener ("click", e=>{
e.preventDefault()
console.log("clicked....")
console.log(username.value,password.value)
let passwords=localStorage.getItem("passwords")
console.log(passwords)
if(passwords==null){
let json=[]
json.push({username:username.value,password:password.value})
alert("Password saved");
localStorage.setItem("passwords",JSON.stringify(json))
}
else {
let json=JSON.parse(localStorage.getItem("password"))
json.push({username:username.value,password:password.value})
alert("Password saved");
localStorage.setItem("passwords",JSON.stringify(json))
}
})