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

Time:04-19

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.

CodePudding user response:

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!

CodePudding user response:

here is an example.

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

  • Related