How to use a novalidate attribute in HTML?


The novalidate attribute in HTML is used to signify that the form won’t get validated on submit. It is a Boolean attribute.

You can try to run the following code to learn how to use novalidate attribute in HTML. In the following example, if you will add text in the <input type=”number”> field, then it won’t show an error.

Example

Live Demo

<!DOCTYPE html>
<html>    
   <head>      
      <title>HTML novalidate attribute</title>    
   </head>    
   <body>      
      <form action = "" method = "get" novalidate>          
          Student Name<br><input type="name" name="sname"><br>          
          Rank<br><input type="number" name="rank"><br>          
          <input type="submit" value="Submit">      
       </form>    
   </body>
</html>


Updated on: 12-Mar-2020

256 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements