Form not validating
Strictly speaking, you should make sure you're using the HTML5 DOCTYPE, otherwise you'll run into HTML validation errors.
The bad news is that it is only partially supported in Safari, and isn't supported at all on i OS Safari, or the default Android browser.It also means that if you click the label, the associated input tag receives the focus.They also help with accessibility, as the text in the label will be read out to screen reader users: it can therefore be useful to indicate required fields by adding ‘required’ to the label text, as I’ve done above.Another option would be to continue to use solely Java Script for your client-side validation, and not add any of the new features discussed above.
A third approach is to use Java Script to detect whether the browser supports form validation, use it if it does, and fall back to Java Script-based validation if it doesn’t.
We can achieve this by adding a pattern attribute to the 'Name' field, setting it's value to the regular expression we want the data to be compared against: The text in the title attribute is then appended to the built-in validation message: Note that some screen reader / browser combinations might lead to the title attribute being read out in addition to the aria-describedby text, so watch out for this e.g.