Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need to hide / obfuscate the credit card number in an input field once its been input. eg: 12345678 -> ****5678

Id appreciate a link to a script i could use as a start. is this a mask task?

thanks!
Mark
Posted

1 solution

If you are okay with them being able to see their text as they type it in, and, when they leave the field, you change it to your obfuscated text, then all you have to do is handle the focus and blur events on the input and do a string replace. You would store the user's value in a hidden form field or other storage mechanism (like a data attribute).

Are you using any JavaScript libraries (like jQuery)? It would make this kind of thing a lot easier.

Cheers,
-jc
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900