HTML5模式允许特定的特殊字符 [英] HTML5 pattern allow specific special characters
本文介绍了HTML5模式允许特定的特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表单中有一个输入文本字段,但我不知道如何过滤所有字母和特殊字符但不接受数字的输入。
I have an input text field in my form but i don't know how to filter the input that can all letters and special characters but will not accept numbers.
<input pattern="[A-Za-z]{1,25}" maxlength="25" type="text" required="required" style="height:20px" value="">
当我输入我的中间名pacaña时它不接受
It doesn't accept when i enter my middle name "pacaña"
我怎么能改变可以接受所有字符/特殊字符和其他特殊字符的模式,比如ñ?
how could i alter the pattern that can accept all characters/special-characters and other special characters like ñ?
推荐答案
pattern="[^0-9]*"
-
[...]
匹配单个字符 -
^
除以下内容外的所有内容(在[]
内) -
0-9
数字0到9 -
*
介于零和无限次之间 […]
matches a single character^
anything except the following (when within[]
)0-9
digits zero through nine*
between zero and unlimited times
这篇关于HTML5模式允许特定的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文