Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a Textarea act like a password field

I am trying to make a textarea look like a password field. In webkit browsers I have found below attribute to make it

-webkit-text-security : circle    

But it does not work in other browsers. Any cross browser alternative for this...?

like image 288
Exception Avatar asked Dec 06 '25 05:12

Exception


1 Answers

You can use JS for this, define a variable and store textarea value in that and replace contents in textarea with any special character. You 'll have actual value in JS variable which could be used to submit the form or validate etc.

For this, you can write a function for keydown event.

like image 151
Riz Avatar answered Dec 08 '25 17:12

Riz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!