How to show star instead of char ?

Posted by Only4ram under ASP.NET on 11/25/2014 | Points: 10 | Views : 249 | Status : [Member] | Replies : 1
Dear Friends,

Can you please tell me that how to show only * when we bind db values to text box not original db value instead of that it should show only *

for example if table have username as 'dotnet' when we bind using textbox it should show as ******


Posted by: kgovindarao523-21772 on: 11/26/2014 [Member] [MVP] Bronze | Points: 25


You have a text box, and its value is 'dotnet'.
Store this value in an hidden field and you can access this value when ever required.
now use below javascript/Jquery.

$(document).ready(function () {
var orgVal = $('#txtStars').val();// 'txtStars' is the text field id.example value is 'dotnet'
$('#txtHidden').val(orgVal);// set value to hidden input, if you did not store prev'ly.

var s = '';
for (var i = 0; i < orgVal.length; i++) {
s = s + '*';
$('#txtStars').val(s);// Now your value is ******
Please mark as answer if it helps you, If not revert back with queries.

Thank you,

Only4ram, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response