HTML5 form validation pattern alphanumeric with spaces?
问题 I have the following input tag in my html5 form: <p> <label>Company Name*</label> <input type="text" name="name" class="field" required pattern="[a-zA-Z0-9]+" /> </p> This works just fine checking if the company name consists out of alphanumeric characters. But of course I want to allow spaces in the company name. I need to know what I should add to the pattern. 回答1: How about adding a space in the pattern attribute like pattern="[a-zA-Z0-9 ]+" . If you want to support any kind of space try