-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (38 loc) · 1.19 KB
/
index.html
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
<html>
<head>
<link rel="stylesheet" href="style.css">
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
</head>
<body>
<div class="container">
<div class="card">
<h1>Counter App</h1>
<p class="count">100</p>
<button><div class="image"><img src="plus.png"><div class="text1">Increment</div></div></button><br>
<button><div class="image"><img src="minus.png"><div class="text2">Decrement</div></div></button>
</div>
</div>
</body>
<script>
var c = document.querySelector(".count");
let count = 1;
setInterval(()=>{
if(count < 100){
count++;
c.innerText = count;
}
},100)
var inc = document.querySelector(".text1");
var dec = document.querySelector(".text2");
inc.addEventListener('click',()=>{
var num = c.innerText;
num ++;
c.innerText = num ;
});
dec.addEventListener('click',()=>{
var num = c.innerText;
num--;
c.innerText = num;
})
</script>
</html>