-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
29 lines (22 loc) · 863 Bytes
/
script.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
const checkBoxList = document.querySelectorAll('.custom-checkbox')
const inputfields = document.querySelectorAll('.goal-input')
const errorlabel = document.querySelector('.error-label')
const progressbar = document.querySelector('.progress-bar')
const progreessvalue = document.querySelector('.progress-value')
checkBoxList.forEach(( checkbox) => checkbox.addEventListener(( 'click',(e) => {
const allGoalsAdded = [...inputfields].every(function(input){
return input.value
})
if (allGoalsAdded){
checkbox.parentElement.classList.toggle('completed')
progreessvalue.computedStyleMap.map = '33.33%'}
else{
progressbar.classList.add('show-error')
}
})
))
inputfields.forEach((input) => {
input.addEventListener('focus', () => {
progressbar.classList.remove('show-error')
})
})