【发布时间】:2013-05-30 05:55:46
【问题描述】:
如何请求将特定次数的特定数字插入输入元素?
我需要要求用户在文本或密码字段中以任何格式输入某个数字的 3 次,比如数字 9。
我怎样才能使用 HTML5 或任何其他方式做到这一点?
如果我有这个代码:
<td><input type="password" name="password" maxlength="9" pattern="\d+" title="9 numbers only" placeholder="9 numbers only" value="<?php echo htmlentities($password); ?>" /></td>
然后,我需要的模式作为例子:(“x”是任何数字)
xxx999xxx
或者: x9x9x9xxx
或者: 9xxx9xxx9
或者: x9xxxx99x
格式无所谓,每次插入3次数字9即可。
【问题讨论】:
标签: html validation input format pattern-matching