HTML5 form validation pattern alphanumeric with spaces?

后端 未结 7 2115
借酒劲吻你
借酒劲吻你 2020-12-08 00:10

I have the following input tag in my html5 form:

7条回答
  •  萌比男神i
    2020-12-08 00:59

    To avoid an input with only spaces, use: "[a-zA-Z0-9]+[a-zA-Z0-9 ]+".

    eg: abc | abc aBc | abc 123 AbC 938234
    

    To ensure, for example, that a first AND last name are entered, use a slight variation like

    "[a-zA-Z]+[ ][a-zA-Z]+"

    eg: abc def
    

提交回复
热议问题