Form noValidate Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form

Description

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

Set the noValidate property with the following Values

Value Description
true|false Sets whether the form-data should be validated on submission
  • true - The form-data should not be validated
  • false - The form-data should be validated

Return Value

A Boolean, returns true if the form-data should not be validated, otherwise it returns false

The following code shows how to check if the form-data should be validated or not:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form id="myForm" action="#">
  E-mail: <input type="email" name="user_email">
  <input type="submit">
</form>//from w  ww .j ava 2s. c  o  m

<button onclick="myFunction()">Test</button>

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

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

</body>
</html>

Related Tutorials