Javascript Ajax jQuery Html PHP Example Quiz New MORE

How to Show Password in jQuery


In this example we will discuss How to Show Passward in jQuery.

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("p").click(function(){
    $(this).hide();
  });
});
</script>
</head>
<body>

 <input type='password' id='test-input' /> Show password <input type='checkbox' id='check' />
<script type='text/javascript'>
        $(document).ready(function(){
            $('#check').click(function(){
             alert($(this).is(':checked'));
                $(this).is(':checked') ? $('#test-input').attr('type', 'text') : $('#test-input').attr('type', 'password');
            });
        });
    </script>
</body>
</html>   
Run it Yourself »