简体   繁体   English

有没有办法在不使用 javascript 的情况下格式化信用卡信息的输入字段?

[英]Is there a way to format the input field for credit card info without using javascript?

I mean the input field needs to be formatted in numeric sets of four digits with a space in between.我的意思是输入字段需要格式化为四位数的数字集,中间有一个空格。 I know a bunch of javascript plugins that do it but this is an accessibility issue and I'm surprised that this requirement hasn't been considered by web standards yet.我知道有很多 javascript 插件可以做到这一点,但这是一个可访问性问题,我很惊讶 Web 标准尚未考虑此要求。

信用卡格式

I have the following input field with some CSS to start with… if it helps or if someone has been down this path before:我有以下带有一些 CSS 的输入字段......如果它有帮助或者之前有人走过这条路:

 form.order>input.card { border: 0; padding: 2.5vmin 5vmin; border-radius: 10vmin; background-color: transparent; color: #111111; outline: 0; font-size: 1em; width: 60vmin; border: 1px solid violet; }
 <form class="order"> <input class="card" type="number" placeholder="xxxx xxxx xxxx xxxx" /> </form>

你可以用这个

 <input id="cc" type="text" data-inputmask="'mask': '9999 9999 9999 9999'" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM