Skip to content

Commit 2a27c0a

Browse files
committed
js logic
1 parent 7b2aae6 commit 2a27c0a

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
let button=document.querySelector("#bttn")
2+
let state=document.querySelector("#state")
3+
4+
let flag=0;
5+
6+
7+
8+
button.addEventListener("click",(event)=>{
9+
if(flag==0){
10+
button.style.backgroundColor="green";
11+
button.innerHTML="Unfriend";
12+
state.innerHTML="Friends";
13+
flag=1;
14+
}else{
15+
button.style.backgroundColor="rgb(98, 98, 238)";
16+
button.innerHTML="Add Friend";
17+
state.innerHTML="Unknown";
18+
flag=0;
19+
}
20+
21+
22+
})

0 commit comments

Comments
 (0)