Javascript DOM HTML Form noValidate Property set

Introduction

Set the noValidate property:

document.getElementById("myForm").noValidate = true;

Click button to specify that the form-data above should not be validated on submission.

View in separate window

<!DOCTYPE html>
<html>
<body>

<form id="myForm" action="/action_page.php">
  E-mail: <input type="email" name="user_email">
  <input type="submit">
</form>/*from w w  w  .  ja va2s .co m*/
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("myForm").noValidate = true;
  document.getElementById("demo").innerHTML = "The novalidate attribute is now added to the form element.";
}
</script>

</body>
</html>



PreviousNext

Related