[英]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.