'How do I make a checkbox that can show password?

Here i was just wanted to make a checkbox that shows a password instead of dots. Here is my code.

```
<html>
  <head>
<title>Calvin's Personal Diary and Notes</title>
<link rel="stylesheet" href="/style.css">
  </head>
  <body>
<h3>what's the magic word???</h3>
<form method="post" action="/diary/diary.php">
  <input type="password" name="RandomPassword" placeholder="password">
  <br>
  <input type="submit" value="Enter?">
</form>
<br> <br>
<a href="/diary/password.html">i don't know the password</a>
  </body>
</html>
```

Now the problem is how to put the Show password checkbox that can show the password instead of dots?



Solution 1:[1]

   function myfunction(){
            var show = document.getElementById('show');
            if (show.type== 'password'){
                show.type='text';
            }
            else{
                show.type='password';
            }
        }
    <div class="box">
        <label for="">Password</label>
        <input type="password" name="" id="show"> <br>
        <label for="">Show Password</label>
        <input type="checkbox" name="" onclick="myfunction()"id="">
 
    </div>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abhishek