-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (27 loc) · 688 Bytes
/
Copy pathapp.js
File metadata and controls
27 lines (27 loc) · 688 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
(function(){
const buttons=document.querySelectorAll(".counterbutton")
let count=0;
buttons.forEach(function(button) {
button.addEventListener('click',function(){
if(button.classList.contains("nextbtn")){
count++;
}
else if (button.classList.contains("prevbtn")){
count--;
}
const counter=document.querySelector('#counter')
counter.textContent=count;
if(count<0)
{
counter.style.color='red';
}
else if(count>0)
{
counter.style.color='green';
}
else{
counter.style.color='black'
}
})
});
}) ()