Learning my way to simple JS form validation

When you use the HTML5 validation, that type occurs immediately without needing to wait until submit.
No JavaScript is needed with that at all.