簡體   English   中英

如何通過輸入屏蔽使文本字段表現得像密碼字段?

[英]How I can make text field behave like password field through input masking?

我不想為我的網站保存密碼。 因此,我嘗試使用 autocomplete = 'off', autocomplete="new-password" 但它不起作用。 現在我想出了輸入屏蔽的想法。 那么能否請您告訴我如何更改文本字段中輸入的每個字符,使其表現得像密碼 * 字符。

這是一個例子。

 .test { text-security: disc; -webkit-text-security: disc; -moz-text-security: disc; }
 <input type="text" class="test">

試試這個,但我認為這只適用於 Chrome。

 document.getElementById("input").oninput = ( function(event) { document.getElementById("text").innerHTML = document.getElementById("input").value; });
 #input { -webkit-text-security: disc; -moz-text-security: disc; }
 <input type="text" name="" id="input"> <p id="text"></p>

謝謝並致以最誠摯的問候!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM