Skip to content

Commit 2a6d4ae

Browse files
Merge pull request #56 from shubhambaghel34/password_visibility
added code for show/hide password functionality
2 parents b034915 + f29d8eb commit 2a6d4ae

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- JavaScript program to show/hide password
2+
3+
This code is contributed by Shubham baghel (username -> shubhambaghel34) in HacktoberFest 2022 -->
4+
5+
6+
<!DOCTYPE html>
7+
<html lang="en">
8+
9+
<head>
10+
<meta charset="UTF-8">
11+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
12+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
13+
<title>HacktoberFest_22</title>
14+
</head>
15+
16+
<body>
17+
<div class="container">
18+
<h3>
19+
JavaScript program to show/hide Password
20+
</h3>
21+
<p>
22+
This JavaScript code is contributed by Shubham Baghel (username -> shubhambaghel34) in HacktoberFest 2022.
23+
</p>
24+
</div>
25+
Enter Password: <input type="password" value="cyberblock" id="passwordid">
26+
<input type="checkbox" onclick="showHidePassword()"/>Show Password</br>
27+
<br><br>
28+
29+
<script>
30+
function showHidePassword() {
31+
var getPasword = document.getElementById("passwordid");
32+
if (getPasword.type === "password") {
33+
getPasword.type = "text";
34+
} else {
35+
getPasword.type = "password";
36+
}
37+
}
38+
</script>
39+
</body>
40+
41+
</html>

0 commit comments

Comments
 (0)