Javascript DOM HTML Button formNoValidate Property set

Introduction

Set the formNoValidate property:

document.getElementById("myBtn").formNoValidate = false;

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

View in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php" method="get">
  E-mail: <input type="email" name="userid"><br>
  <button id="myBtn" type="submit" formnovalidate>Submit</button>
</form>//w w  w . j  a  va2  s.  c  o m
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
  document.getElementById("myBtn").formNoValidate = false;
  document.getElementById("demo").innerHTML = "The formnovalidate attribute in the submit button is no longer present.";
}
</script>

</body>
</html>



PreviousNext

Related