Comment faire un bouton Afficher le mot de passe

function myFunction() {
  var x = document.getElementById("*passwordbox-id*");
  if (x.type === "password") {
    x.type = "text";
  } else {
    x.type = "password";
  }
}
ELECTROMAGNETIC-XXX-CHEESE