Override html5 validation

Please be advised that — even though some browsers may support the attribute novalidate on INPUT elements — the HTML code does not validate.

According to documentation there is no such attribute. Only the FORM element may contain the novalidate attribute.

  • https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
  • http://www.w3.org/TR/html5/forms.html#the-form-element
  • http://www.w3.org/TR/html5/forms.html#the-input-element

This answer is incorrect. Please see willydee's answer.

Simple, just add the novalidate property to any element you don't want the browser to validate, like so:

<form>
  <input type="email" name="email" required novalidate />
  <input type="password" name="password" required />
  <button type="submit">Log in</button>
</form>

Since you wish to only cancel validation when JavaScript is available, add it with JavaScript (using jQuery for simplified example)

$('input[novalidate]').attr('novalidate', 'novalidate');