Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用掩码输入插件来显示 ssn。我正在从数据库中获取 ssn 值。所有的 ssn 都应该用 * 屏蔽,只应该显示最后四位数字。示例***-***-1234. 有人可以帮助我吗?
***-***-1234.
您不想在 jQuery 中执行此操作 - 您想在后端执行此操作.. 否则最终用户将看到它 - 例如,如果他们启用了 JavaScript。
在后端执行此操作意味着发送到浏览器的数据不包含此信息,例如(我不知道您使用什么后端语言/数据库)您可以创建一个查询:
select SUBSTRING(ssn, -4) from table
这将只从字段中获取最后 4 个字符ssn...然后*使用 HTML 在页面上添加
ssn
*