41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
$(document).ready(function() {
|
|
if ($("#password").length > 0) {
|
|
let passwordInput = document.getElementById('password'),
|
|
toggle = document.getElementById('btnToggle'),
|
|
icon = document.getElementById('eyeIcon');
|
|
|
|
function togglePassword() {
|
|
if (passwordInput.type === 'password') {
|
|
passwordInput.type = 'text';
|
|
icon.classList.add("fa-eye-slash");
|
|
//toggle.innerHTML = 'hide';
|
|
} else {
|
|
passwordInput.type = 'password';
|
|
icon.classList.remove("fa-eye-slash");
|
|
//toggle.innerHTML = 'show';
|
|
}
|
|
}
|
|
|
|
toggle.addEventListener('click', togglePassword, false);
|
|
}
|
|
|
|
if ($("#password_confirmation").length > 0) {
|
|
let passwordInputConfirmation = document.getElementById('password_confirmation'),
|
|
toggle_confirmation = document.getElementById('btnToggle_password_confirmation'),
|
|
icon_confirmation = document.getElementById('eyeIcon_password_confirmation');
|
|
|
|
function togglePasswordConfimation() {
|
|
if (passwordInputConfirmation.type === 'password') {
|
|
passwordInputConfirmation.type = 'text';
|
|
icon_confirmation.classList.add("fa-eye-slash");
|
|
//toggle.innerHTML = 'hide';
|
|
} else {
|
|
passwordInputConfirmation.type = 'password';
|
|
icon_confirmation.classList.remove("fa-eye-slash");
|
|
//toggle.innerHTML = 'show';
|
|
}
|
|
}
|
|
|
|
toggle_confirmation.addEventListener('click', togglePasswordConfimation, false);
|
|
}
|
|
}); |