-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhi.html
More file actions
31 lines (28 loc) · 814 Bytes
/
hi.html
File metadata and controls
31 lines (28 loc) · 814 Bytes
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
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<title>Javascript in browser</title>
<body>
<h1>Counter</h1>
<div id="counter">0</div>
<button id="increment">+</button>
<button id="decrement">-</button>
<script>
let count = 0;
const counterDiv = document.getElementById('wrong-counter');
const incrementButton = document.getElementById('increment');
const decrementButton = document.getElementById('decrement');
const render = ()=>{
counterDiv.innerHTML = count;
}
incrementButton.addEventListener('click', () => {
count++;
render()
});
decrementButton.addEventListener('click', () => {
count--;
render();
});
</script>
</body>
</html>