ユーザー名とパスワードを使用してログインページを作成しています。 "input type =" password ""を使用してアスタリスクとしてパスワードフィールドを作成しましたが、生の文字を表示する前にアスタリスク記号を1秒間表示したいとします。パスワードフィールドをアスタリスクで1秒後にhtmlで表示する方法
3
A
答えて
3
このプラグインは、すべてのデバイスと互換性があります。 https://blog.decaf.de/2009/07/07/iphone-like-password-fields-using-jquery/
これは別の解決方法ですが、フィールドからぼかさない限り、最後の文字は隠されません。 http://www.sitepoint.com/better-passwords-1-the-masked-password-field/
//apply masking to the demo-field
//pass the field reference, masking symbol, and character limit
new MaskedPassword(document.getElementById("demo-field"), '\u25CF');
//test the submitted value
document.getElementById('demo-form').onsubmit = function(){
\t alert('pword = "' + this.pword.value + '"');
\t return false;
};
<script src="http://www.sitepoint.com/examples/password/MaskedPassword/MaskedPassword.js"></script>
<form id="demo-form" action="#">
<fieldset>
<label for="demo-field"><strong>This is a masked-password field.</strong> Type into the field to see the masking effect:</label>
<span style="position: relative;">
<input type="hidden" name="pword" value="sasasas">
<input class="password masked" id="demo-field" value="" type="text" autocomplete="off">
</span>
</fieldset>
</form>
0
最初はタイプtext
のinput
フィールドを使用する必要があります。以下に示すように、後にsetTimeout
で、あなたはpassword
にタイプを変更することができます。
HTML:
<label>Password</label>
<input type="text" name="password" value="[email protected]" />
JS:
setTimeout(function() {
document.getElementsByTagName('input')[0].type = "password"
}, 1000);
はここdemoを参照してください。
0
setTimeout
をjQueryで使用すると、attr
をtype=text
からpassword
に変更することができます。しかし、これは良い方法ではありません。
mouse-over/mouse-out
を使用して、以下に示すようなものを使用できます。
$(document).ready(function(){
$("#method2").mouseover(function(){
this.type = "text";
}).mouseout(function(){
this.type = "password";
})
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<input type="password" id="method2" value="" placeholder="Type in your password" /> Event using mouseover and mouseout
あなたはまた、それを古い方法を行うことがあります。
//Place this plugin snippet into another file in your applicationb
(function ($) {
$.toggleShowPassword = function (options) {
var settings = $.extend({
field: "#password",
control: "#toggle_show_password",
}, options);
var control = $(settings.control);
var field = $(settings.field)
control.bind('click', function() {
if (control.is(':checked')) {
field.attr('type', 'text');
} else {
field.attr('type', 'password');
}
})
};
}(jQuery));
//Here how to call above plugin from everywhere in your application document body
$.toggleShowPassword({
field: '#test1',
control: '#test2'
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Password:
<input type="password" id="test1" value="" placeholder="Type your password" />
<input id="test2" type="checkbox" />Show password
出典:fiddle
関連する問題
- 1. テキストを表示1秒後に表示
- 2. ZF 1に2つのパスワードフィールドを表示する方法は?
- 3. 無限ループ(Html)1秒後にテキストを非表示にする(Html)
- 4. アンドロイドスタジオで5秒後にボタンを表示する方法は?
- 5. Android - 数秒後にボタンを非表示にする方法
- 6. 私のpythonプログラムでパスワードをアスタリスクで表示する方法
- 7. 3秒後にナビバーを表示する方法は?
- 8. HTMLパスワードフィールドに表示されているシンボルを変更する
- 9. 1秒後に数字を1つずつ表示したい
- 10. 無限ループ(Html)で6秒後にテキストを非表示にする
- 11. C++で入力パスワードのアスタリスクを表示する方法
- 12. ミリ秒を表示する方法
- 13. パワーアプリ時間を1時間単位で表示する方法:分:秒フォーマット
- 14. Logstashで「1秒あたりのイベント数」を表示する方法は?
- 15. jqueryでX秒後にタグを非表示/非表示にする
- 16. 1秒後にキャンバスctx.rect()を非表示 - Javascript
- 17. 開かれた1秒後に角度UIモーダルを表示
- 18. vb.netでcurrnt時間を秒単位で表示する方法
- 19. POST後にHTMLを表示する方法は?
- 20. 秒後にAngularJSに読み込みアイコンを表示する方法は?
- 21. エラー表示メッセージを数秒間表示する方法 - Laravel
- 22. ビューに1秒間画像を表示
- 23. xcodeでパスワードフィールドを作成する方法
- 24. phpldapadminでパスワードフィールドが表示されない
- 25. ページロードの2秒後にdivを表示
- 26. x秒後にバルーンを表示
- 27. 数秒後にアラートビューを表示
- 28. ナビゲーションメニューでマウスのホバーを10秒間表示する方法は?
- 29. 数秒間表示ポップアップを表示します。数秒後に自動的に非表示になります。
- 30. アスタリスクが10秒後に電話を切る
なぜあなたはこれをしたいのでしょうか?一部のモバイルデバイス(Android搭載端末)では、デフォルトで 'type =" password "の入力フィールドにこれを実行しています。 – yjwong
この機能をHTML Webページに実装したい –