简体   繁体   中英

input to only accept alpha chars (no numbers, or special)

I am trying to limit a text input field to only accept alphabetical characters (uppercase and lowercase is fine; but no numbers or special chars) . I am trying the below for instance:

<input id='style-name'type="text" data-value-field="value" name="styleName" required pattern="^[a-z]$"/>

What am I doing incorrect here? Ideally, I would just do this on the HTML side.

您应该添加加号+号,以匹配输入中键入的一个或多个字符:

<input id='style-name'type="text" data-value-field="value" name="styleName" required pattern="^[A-Za-z]+$"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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