【发布时间】:2020-07-29 13:38:27
【问题描述】:
我有一个要求,我需要使用 javascript 屏蔽信用卡号的数字,但前四位和后四位除外。
信用卡值将仅作为一个输入框的一部分被捕获,我需要在用户输入值后屏蔽数字
例如:
Suppose the credit card number is :
4000 5000 6000 7000
while the user enters the input the first four digits i.e.
4000 will be visible but while the user enters the digit '6'
it should be visible for some time and then get masked.
The output after entering all the digits would need to look like:
4000 XXXX XXXX 7000
Also i would need the actual card number to be captured separately for processing
我找到了在用户输入整个卡号后屏蔽卡号的解决方案,但在用户使用一些 javascript 事件输入值时没有做任何事情。因为我是 javascript 新手,所以我可以完成一些指导这真的很有帮助
【问题讨论】:
-
@VanquiishedWombat 你的骗子似乎没有像我的替代方法那样捕获输入的值
-
出于好奇,这个要求试图解决什么问题?我从不背诵我的信用卡,所以我在打字时把信用卡放在设备旁边。
-
@ÁlvaroGonzález 在键入时屏蔽卡的中间数字不会强制他记住卡号。这只是为了安全目的,以便在键入时看不到整个卡号
-
@ÁlvaroGonzález 我从我的密码管理器中粘贴了我的。
标签: javascript jquery