Aapka Apna blog jo kre apki problem Solve

Friday, 12 July 2019

Show and hide password using JavaScript



Show and hide password using JavaScript





 <!DOCTYPE html>

 <html>

 <head>

  <title>Password</title>


  <style type="text/css">

 


  body{

  background-color: black;

  }

  h1{

  color:white;

  }


      input[type="checkbox"]{

      width: 30px;

      }

  </style>

 </head>

 <body>

 

   <center>

   

    <h1> Change Password With Javascript</h1>


    <input type="Password" name="" id="show"> <br><br>

    <input type="checkbox" name="" id="pass" onclick="myfun()"> <h1>Show Password</h1>


   </center>


    <script type="text/javascript">

   

    function myfun() {

    var x = document.getElementById('show');


    if (x.type == "password") {

    x.type = "text";

    }

    else{

    x.type = "password";

    }

    }


    </script>

 </body>

 </html>

Share:

0 Comments:

Post a Comment

loading...