You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dick/src/public/js/show-password.js

28 lines
750 B

// DOM Ready Function
function ready(fn) {
if (document.readyState != 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
// DOM Ready Called
ready(function () {
const inputPasswordType = document.getElementById('inputPasswordType')
const checkboxPassword = document.getElementById('checkboxPassword')
function changeInputPasswordType() {
checkboxPassword.addEventListener('change', (eve) => {
const checked = eve.target.checked
if (checked) {
inputPasswordType.type = 'text'
} else {
inputPasswordType.type = 'password'
}
});
}
changeInputPasswordType();
});