-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (35 loc) · 1.27 KB
/
index.js
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
42
43
44
const substractBtn = document.getElementById("substractBtn");
const addBtn = document.getElementById("addBtn");
const counterDisplay = document.getElementById("counterValue");
const counteArea = document.getElementById("counter_area");
const setBtn = document.getElementById("form_container").lastElementChild;
const input = document.getElementById("form_container").firstElementChild;
let count = Number(counterDisplay.innerText);
substractBtn.addEventListener("click", function decrement() {
count = count - 1;
counterDisplay.innerText = count;
});
addBtn.addEventListener("click", function increment() {
count++;
counterDisplay.innerText = count;
});
setBtn.addEventListener("click", function () {
//prendre la valeur de l'input
let inputValue = input.value;
//assigner la valeur au DisplayContainer
count = inputValue;
counterDisplay.innerText = count;
// TODO 1: vider le champs apres le clic
});
// TODO 2: add reset function
function resetForm(){
counterValue.textContent = 0;
// reset vide le champs et remet le compteur a zero
input.value = "";
}
document.getElementById("substractBtn").addEventListener("click",() =>{
});
document.getElementById("addBtn").addEventListener("click",() =>{
});
// TODO 3: faire sans la variable count
// TODO 4: faire le style CSS