-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclickMe.html
40 lines (35 loc) · 984 Bytes
/
clickMe.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
<!DOCTYPE html>
<html>
<head>
<title>Button Click Counter</title>
<style>
body {
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
text-align: center;
margin-top: 50px;
}
.button-style{
padding: 10px 20px;
font-size:16px;
cursor: pointer;
}
.counter-style{
margin-top: 20px;
font-size:20px;
}
</style>
</head>
<body>
<button id="clickButton" class="button-style" data-action="increment" role="button"> CLICK ME</button>
<div id="counter" class="counter-style" data-counter="number">0</div>
<script>
let count = 0;
const button = document.getElementById('clickButton');
const counter = document.getElementById('counter');
button.onclick = function() {
count++;
counter.innerText = count;
}
</script>
</body>
</html>