<html>
  <head>
    <meta charset="utf-8">
    <title>Password Tutorial</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
    <link rel="stylesheet" href="style.css">
    <script type="text/javascript" src="script.js"></script>
  </head>
  <body>
    <div class="container">
      <div class="first-example">
        <input type="password" id="password-field" >
        <i id="pass-status" class="fa fa-eye" aria-hidden="true" onClick="viewPassword()"></i>
      </div>
      
      
      
    </div>

  </body>
</html>
html, body {
  height: 100%;
  background: #212121;
  margin: 0px;
}
.first-example , .second-example, .third-example{
  margin-bottom: 10px;
}
body {
  align-items: center;
  justify-content: center;
  display: flex;
}

input {
  width: 250px;
  padding: 15px 12px;
  font-size:22px;
}
.fa{
  color:white;
  font-size:27px;
  margin-left:8px;
}
#validation-txt{
  color:red;
  font-size:18px;
  width: 300px;
}
#password-3{
  -webkit-text-security: disc;
    -moz-text-security:circle;
     text-security:circle;
}
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
function viewPassword()
{
  var passwordInput = document.getElementById('password-field');
  var passStatus = document.getElementById('pass-status');
 
  if (passwordInput.type == 'password'){
    passwordInput.type='text';
    passStatus.className='fa fa-eye-slash';
    
  }
  else{
    passwordInput.type='password';
    passStatus.className='fa fa-eye';
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.