How Not to Validate HTML5 Input with Required Attribute



To avoid validation, use the formnovalidate attribute in HTML5. In the example, validation is disabled for the 2nd button −

Example

<!DOCTYPE html>
<html>
   <head>
      <title>HTML formnovalidate attribute</title>
   </head>
   <body>
      <form action = "new.php" method = "get">
         Rank <input type = "number" name = "rank" required><br>
         <input type = "submit" value = "Submit"><br>
         <input type = "submit" formnovalidate = "formnovalidate" value = "Submit with no validation">
      </form>
   </body>
</html>
Updated on: 2020-06-25T06:47:22+05:30

196 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements