Computer >> Computer tutorials >  >> Programming >> Javascript

Is HTML 5 validation useful?


Yes, HTML5 validation is useful and useful to validate forms as well. Now you do not need to have JavaScript for client-side validations like empty text box would never be submitted because HTML5 introduced a new attribute called required.

Let us see an example −

<!DOCTYPE HTML>
<html>
   <body>
      <form action = "/cgi-bin/html5.cgi" method = "get">
         Enter email : <input type = "text" name = "newinput" required/>
         <p>Try to submit using Submit button</p>
         <input type = "submit" value = "submit" />
      </form>
   </body>
</html>