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.

25 lines
1.1 KiB

// onloadjs: https://ryfarlane.com/article/on-load-vanilla-javascript
// onclick : https://gomakethings.com/listening-for-click-events-with-vanilla-javascript/
console.log('scripts loaded');
document.onreadystatechange = function(event) {
if (document.readyState === "complete") {
console.log('document loaded');
document.addEventListener("click",function (event) {
console.log(event.target);
if(event.target.matches('.icon-eye') || event.target.matches('.icon-eye-blocked'))
{
console.log("click sur l'oeil");
if(document.getElementById('pwd').getAttribute("type") === "password")
{
document.getElementById('pwd').setAttribute("type","text");
event.target.setAttribute("class","icon-eye-blocked");
}
else
{
document.getElementById('pwd').setAttribute("type","password");
event.target.setAttribute("class","icon-eye");
}
}
});
}
}