Encapsulationg the jsquery in php button to show and hide the password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Striker1989
    New Member
    • Mar 2017
    • 1

    Encapsulationg the jsquery in php button to show and hide the password

    Code:
    <!doctype html> <head> <title>Show password </title> <script>
    //show password button
    $(document).ready(function(){
    	$("#showpassword").on('click', funtion(){
    		var pass = $('"password");
    		var fieldtype = pass.attr('type');
    		if(fieldtype == 'password'){
    			pass.attr('type','text');
    			$(this).text("Hide Password");
    			
    		}else{
    			pass.attr('type','password');
    			$(this).text("Show Password");
    		}
    	});
    });
    
    </script> </head> <body> <form action = "https://bytes.com/" method = "post"> <input type = "password" placeholder = "Enter password" name = "password" id = "password"> <button type = "submit" value = "show password" name = "showpassword" id = "showpassword" >Show Password</button> </form> </body> </html>
    This function is not working.i got this from online tutorial video.i tried it but it not working.
    can anyone tell me the reason y isnt working.
    tutorial Video link:
    http://www.trainingwithliveproject.c...-tutorial.html.
    Last edited by Dormilich; Mar 31 '17, 07:26 AM. Reason: please use code tags
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    This function is not working.
    the error console (F12) will tell you why.

    Comment

    Working...