w3resource

HTML5: Specify that the form should not be validated when submitted?

Go To Exercise page

Solution :

HTML Code:

<!DOCTYPE html><!-- Opening tag for declaring the document type -->
<html><!-- Opening tag for the root element of the HTML document -->
<head><!-- Opening tag for the document's header section -->
<meta charset="utf-8"><!-- Metadata tag specifying the character encoding of the document -->
<title>example of html5 novalidate attribute</title><!-- Title of the HTML document -->
</head><!-- Closing tag for the document's header section -->
<body><!-- Opening tag for the document's body section -->
<form <!-- Opening tag for the form element -->
action="https://www.w3resource.com/html-css-exercise/basic/solution/form-novalidate-answer-demo.php" <!-- Attribute specifying the action URL for the form -->
method="get" novalidate><!-- Attributes specifying the HTTP method used to submit the form and novalidate attribute to disable browser validation -->
  E-mail: <input type="email" <!-- Input field for entering an email address -->
name="user_email" required><!-- Name attribute specifies the name of the input field and required attribute specifies that the field is required -->
<input type="submit"><!-- Submit button for submitting the form -->
</form><!-- Closing tag for the form element -->
</body><!-- Closing tag for the document's body section -->
</html><!-- Closing tag for the root element of the HTML document -->

Explanation:

  • This HTML code demonstrates a form with the novalidate attribute.
  • The novalidate attribute is a boolean attribute that, when present, disables browser validation of the form.
  • In this case, novalidate is set on the form element to disable validation.
  • The form's action attribute specifies the URL to which the form data will be submitted upon submission, and the method attribute specifies the HTTP method used, in this case, GET.
  • Inside the form element, there is an input field for entering an email address. The required attribute is also added to this input field to specify that it is a required field.
  • There is a submit button for submitting the form.

Live Demo:

See the Pen form-novalidate-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
YesYesYesYesYes

Go To Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/html-css-exercise/basic/form-novalidate-answer.php