I used this approach for a project of mine, so the invalid fields would be highlighted only after submit:
HTML:
<form>
<input type="email" required placeholder="Email Address">
<input type="password" required placeholder="Password">
<input type="submit" value="Sign in">
</form>
CSS:
input.required:invalid {
color: red;
}
JS (jQuery):
$('[type="submit"]').on('click', function () {
// this adds 'required' class to all the required inputs under the same <form> as the submit button
$(this)
.closest('form')
.find('[required]')
.addClass('required');
});