TL;DR Replace your JavaScript validation with HTML5 validation. It’s easier than you think, and gives you a ton of markup and styling control. Try this demo: So you need to validate a form. You do the right thing and start with server-side validation.
Full article