-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
25 lines (21 loc) · 780 Bytes
/
main.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
document.querySelector('.stay-signed-in').addEventListener('click', (e) => {
e.stopPropagation();
console.log(
(e.currentTarget.children[0].checked = !e.currentTarget.children[0].checked)
);
});
document
.querySelector('.stay-signed-in__switch')
.addEventListener('click', (e) => {
e.currentTarget.classList.toggle('toggle-switch');
});
document
.querySelector('.toggle-password-visibility')
.addEventListener('click', (e) => {
const passwordIsVisible = /hide/.test(e.target.src);
const inputType = passwordIsVisible ? 'password' : 'text';
document.querySelector('.password__input').setAttribute('type', inputType);
e.target.src = passwordIsVisible
? 'images/icon-show-password.svg'
: 'images/icon-hide-password.svg';
});