@excelwebzone/symfony-admin-ui
Version:
Symfony Admin UI is a simple set of UI behaviors and components used with your [symfony-admin](https://github.com/excelwebzone/symfony-admin-bundle) application.
23 lines (19 loc) • 492 B
JavaScript
import $ from 'jquery';
const showPassword = checkbox => {
const $password = $($(checkbox).data('target'));
if ($password.attr('type') === 'password') {
$password.attr('type', 'text');
} else {
$password.attr('type', 'password');
}
};
$(() => {
$(document).on('click', '.js-show-password', (e) => {
showPassword(e.currentTarget);
});
for (let checkbox of $('.js-show-password')) {
if ($(checkbox).is(':checked')) {
showPassword(checkbox);
}
}
});