| 171 | |
| 172 | // function that handles the checkboxes state, so at least one needs to be selected. The last checkbox will be disabled. |
| 173 | function disableOnlyCheckbox(){ |
| 174 | let totalChecked = [uppercaseEl, lowercaseEl, numberEl, symbolEl].filter(el => el.checked) |
| 175 | totalChecked.forEach(el => { |
| 176 | if(totalChecked.length == 1){ |
| 177 | el.disabled = true; |
| 178 | } |
| 179 | else{ |
| 180 | el.disabled = false; |
| 181 | } |
| 182 | }) |
| 183 | } |
| 184 | |
| 185 | [uppercaseEl, lowercaseEl, numberEl, symbolEl].forEach(el => { |
| 186 | el.addEventListener('click', () => { |