How to show and hide password using html and javasrcipt/ input field show & hide password


Source Code:

<!DOCTYPE html>
<html>
<head>
    <title>Show password</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>
 
   <div class="container">
   <h2>Show password</h2>

   <input type="password" name="password" value="shahin" id="myinput">

   <button id="eyeop" onclick="showpassword()"><span class="glyphicon glyphicon-eye-open"></span></button>   
   <button id="eyecls" onclick="showpassword()" style="display: none;"><span class="glyphicon glyphicon-eye-close"></span></button>
   </div>
  <script type="text/javascript">
      function showpassword(){
    var data=document.getElementById('myinput');
    if(data.type=='password'){
        data.type='text';
        eyeop.style.display="none";
        eyecls.style.display="block";
    }else{
        data.type='password';
        eyeop.style.display="block";
        eyecls.style.display="none";
    }
      }
  </script>
</body>
</html> 


অবসর সময়ে টাকা ইনকামের সহজ মাধ্যম বাসা বাড়ি বিডি ডটকম।



No comments

Powered by Blogger.