Javascript DOM HTML Form noValidate Property get

Introduction

Find out if the form-data should be validated or not:

var x = document.getElementById("myForm").noValidate;

Click button to find out if the form-data should be validated or not, when submitted.

View in separate window

<!DOCTYPE html>
<html>
<body>

<form id="myForm" action="/action_page.php" novalidate>
  E-mail: <input type="email" name="user_email">
  <input type="submit">
</form>/*www.j a  v  a  2  s .com*/
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
  var x = document.getElementById("myForm").noValidate;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The noValidate property sets or gets whether the form-data should be validated on submission.

By default, form-data inside <form> elements will be validated on submission.

The noValidate property accepts and returns a boolean type value.

Property Values

Value Description
true The form-data should not be validated
false The form-data should be validated

The noValidate property returns true if the form-data should not be validated, otherwise it returns false.




PreviousNext

Related