[英]ASPX Password textbox
默认情况下,密码字段框会屏蔽用户键入的所有文本** 。
我希望能够在密码字段框中显示一个字符串。
因此,在加载密码控件时,应该首先说“请输入您的密码”。
目前aspx显示为* ** * ***
我怎样才能做到最好?
干杯
使用TextMode。
<asp:TextBox ID="Password" runat="server" TextMode="Please enter your Password"
onclick="this.value=''; this.type='password'; ">Password
</asp:TextBox>
要么
使用占位符。
对于EX:
<input type="password" placeholder="Please enter your Password">
你可以使用jquery来实现它:
HTML:
<input id="password" value="password" class="password-input" />
JS:
$('.password-input').bind('click', function() {
if ($(this).val() === "Please enter your Password")
{
this.type = "password";
$(this).val('');
}
});
$('.password-input').bind('blur', function() {
if ($(this).val() === "")
{
this.type = "text";
$(this).val('Please enter your Password');
}
});
的jsfiddle:
您还可以查看以前有关同一事项的SO问题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.