08-29-2024, 03:31 PM
If you want to let users show/hide the password instead of the dots in the password field, you can do it like this:
<input id="password" name="password" type="password" value="" confirm="" required="true">
<input id="showpassword" type="checkbox" onclick="showPW()">
<label for="showpassword">Show password</label>
<script>
function showPW() {
var x = document.getElementById("password");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
</script>
This works by displaying the login info that the user has stored in their browser, it can't pull info from the database.
<input id="password" name="password" type="password" value="" confirm="" required="true">
<input id="showpassword" type="checkbox" onclick="showPW()">
<label for="showpassword">Show password</label>
<script>
function showPW() {
var x = document.getElementById("password");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
</script>
This works by displaying the login info that the user has stored in their browser, it can't pull info from the database.