Forum Discussion
LonTcopp
3 years agoCommunity Member
Converting input text to a password icon/asterisk as you type?
Hello: can this be done?: Id like a user to type a password into a box. As they type, the letter are instantly concerted to small circles or asterisks as happe d when you enter a password in a sit...
CorporateTra830
7 months agoCommunity Member
I tried this is not working.
Nedim
6 months agoCommunity Member
Try this when the timeline starts:
var input = document.querySelector('.acc-textinput');
input.addEventListener("keydown", function () {
let length = input.value.length;
input.value = "*".repeat(length);
});
- Susan_B_Rice732 months agoCommunity Member
Thank Nedim! This variable worked for me. I tweaked the trigger a bit to have the JavaScript execute when the user clicks in the text entry box. Worked that way too. I did notice that if there are multiple text entry fields, this only works in one of them.
Jean-Guy-Boulay - I tried your JavaScript too and couldn't get it to work even after ensuring I updated the areas you specified in your comment below. Not sure what I may have done incorrectly.
- Jean-Guy-Boulay2 months agoCommunity Member
Thanks, I see what I left out. I had a keydown listener on another trigger.
- Nedim2 months agoCommunity Member
This one will target multiple text entry fields:
var inputs = document.querySelectorAll('.acc-textinput'); inputs.forEach(input => { input.addEventListener("keydown", function () { let length = input.value.length; input.value = "*".repeat(length); }); })
Related Content
- 10 months ago