import './bootstrap.js'; /* * Welcome to your app's main JavaScript file! * * This file will be included onto the page via the importmap() Twig function, * which should already be in your base.html.twig. */ import './styles/app.css'; function showPasswd(selector) { const icon = document.querySelector(selector); const pwInput = document.querySelector('#pass-field'); icon.addEventListener('click', function () { if (pwInput.getAttribute('type') === 'password') { this.firstElementChild.classList.remove('fa-eye-slash'); this.firstElementChild.classList.add('fa-eye'); pwInput.setAttribute('type', 'text'); } else { this.firstElementChild.classList.remove('fa-eye'); this.firstElementChild.classList.add('fa-eye-slash'); pwInput.setAttribute('type', 'password'); } }); } document.addEventListener('DOMContentLoaded', () => { if (location.pathname.includes('login')) { showPasswd('#show-pw'); } });