كيف - تبديل رؤية كلمة المرور
التبديل بين رؤية كلمة المرور باستخدام JavaScript.
كلمة المرور:
عرض كلمة المرور
تبديل رؤية كلمة المرور
الخطوة 1) أضف HTML:
مثال
<!-- Password field -->
Password: <input type="password" value="FakePSW"
id="myInput">
<!-- An element to toggle between password visibility -->
<input type="checkbox" onclick="myFunction()">Show Password
الخطوة 2) أضف JavaScript:
مثال
function myFunction() {
var x = document.getElementById("myInput");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}