Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

How to change the Text-box mode to password using JavaScript.

Thanks in Advance.
Posted

 
Share this answer
 
Comments
Abhishek Pant 25-Jan-13 9:12am    
+5
fjdiewornncalwe 25-Jan-13 10:04am    
+5. Good link
AshishChaudha 27-Jan-13 23:54pm    
my 5+
Hi,

You can use like the following:

<asp:TextBox ID="txtPassword" runat="server" Width="200px" onblur="ChangeMode()"  ></asp:TextBox>


C#
ChangeMode()
{
   document.getElementById("txtPassword").attr('TextMode', 'Password');
}


Thanks
 
Share this answer
 
v2
Try with this line of code..
textbox1.Attributes.Add("onblur", "this.type='password';");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900