简体   繁体   中英

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

I dont want to save password for my site. So, I tried with autocomplete = 'off', autocomplete="new-password" but it is not working. Now I come up with input masking idea. So could you please let me know how I can change each character enter in text field to behave like password * character.

here is an example.

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

Just try this one but I think this will only work in 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>

Thanks and best regards!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM