Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Show Hide Password Characters or Field without Any Plugin

Jan 27, 2014
Introduction:

Here I will explain how to use
jQuery to show hide password characters or jQuery show hide password field.
Description:

In previous articles I explained JavaScript show number of characters remaining in textarea, jQuery set maxlength for multiline textbox, jQuery stop form being submit on keypress, jQuery check undefined or empty value and many articles relating to jQuery, JavaScript, Asp.net, SQL server. Now I will explain how to show or hide password characters using jQuery.

To show or hide password characters in jQuery we need to write the code like as shown below


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Show or Hide Password</title>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(function () {
$('#showpwd').hide();

$('#btnclick').click(function () {
var txt = $('#btnclick').val()
var pwd = $('#hidepwd').val();
if (pwd.length > 0) {
if (txt == 'Show Password') {
$(this).val('Hide Password');
$('#showpwd').val($('#hidepwd').val());
$('#showpwd').show();
$('#hidepwd').hide();
return false;
}
else if (txt == 'Hide Password') {
$(this).val('Show Password');
$('#showpwd').hide();
$('#hidepwd').show();
return false;
}
}
else {
alert('Plese Enter Password');
return false;
}
});

})
</script>
</head>
<body>
<form id="form1">
<div>
<b>Enter Password: </b>
<input type="password" id="hidepwd" />
<input type="text" id="showpwd" />
<input type="button" id="btnclick" value="Show Password" />
</div>
</form>
</body>
</html>
Once we run above query we will get output like as shown below

Live Demo



Enter Password:

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

6 comments :

Anonymous said...

nice......................

Anonymous said...

awesome...

Ashish Jain said...

Dear Suresh ji, Please teach us MVC. You can plan CRUD functionality in MVC 3 or 4 page application. In that you can show JQuery stuff also. I want to learn thats why i am giving the suggestion.

akash jagtap said...

Hi Suresh Sir, i have a web cam and it captures a face and i want to compare capture face with stored face picture . how can i do it . the capture face is displaying on picture box . Code written in C# asp.net

Bhagawat007 said...

Very good

Anonymous said...

Sir, I like Your every post,

sir is there any way of uploading file to server by FTP

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.