简体   繁体   中英

Styling or override input text with password mask

Let's say I have this

Name : <input type="text" name="name" />

I want to mask the user input with password sign either like asterix or dot. Is it possible to do this?

Yes, I know I could do Password : <input type="password" /> but I want to do with input type="text" . Is it possible?

Thank you

I don't know why you want to do this as we have type="password" but still if you want to hide the fields which have type="text" than you can use this (Only webkit)

input[type="text"] {
  -webkit-text-security: disc;
}

Demo (Webkit Only)

只需将类型更改为密码即可。

Name : <input type="password" name="name" />

你应该使用

<input type="password"/>

如果你不想使用input type =“password”。使用javascript keyup函数并制作一个自定义替换函数

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