Introduction:
Here I will explain how to use jQuery to show hide password characters or jQuery show hide password field.
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.
<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. |
|||
|
|||
6 comments :
nice......................
awesome...
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.
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
Very good
Sir, I like Your every post,
sir is there any way of uploading file to server by FTP
Note: Only a member of this blog may post a comment.