mastercut/public/assets/js/forms/toggle-password-icon.js

30 lines
977 B
JavaScript

$(document).ready(function () {
feather.replace();
$(".password-wrapper").each(function () {
const $wrapper = $(this);
const $passwordInput = $wrapper.find('input[type="password"]');
const $passwordIcon = $('<apan class="toggle-password">' +
'<i data-feather="eye" class="feather-eye"></i>' +
'<i data-feather="eye-off" class="feather-eye-off" style="display:none;"></i>' +
'</apan>');
$wrapper.append($passwordIcon);
feather.replace();
$passwordIcon.find(".feather-eye").on("click", function () {
$(this).hide();
$passwordIcon.find(".feather-eye-off").show();
$passwordInput.attr('type', 'text');
});
$passwordIcon.find(".feather-eye-off").on("click", function () {
$(this).hide();
$passwordIcon.find(".feather-eye").show();
$passwordInput.attr('type', 'password');
});
});
});