Saturday, 4 February 2017

HTML5 NEW FORM ATTRIBUTES

HTML5 supports the following new form attributes –

·        Autocomplete – It specifies whether a form or input field should have autocomplete on or off. When autocomplete is on then the browser automatically complete values based on the values that the user has already entered before.
Note – Default autocomplete is on.
<!DOCTYPE html>
<html lang="en-us">
<head>
          <meta charset="UTF-8"/>
          <title>Welcome</title>       
</head>
<body>     
          <form action="home.html" autocomplete="off">
                   First Name <input type="text" name="fname"/><br/>
                   Email <input type="email" name="e1"><br/>        
                   <input type="submit" value="Login" name="sub">        
          </form>   
</body>
</html>


·        Novalidate – It is a boolean attribute. When present it specifies that the form data(input) should not be validated when submitted.
<!DOCTYPE html>
<html lang="en-us">
<head>
          <meta charset="UTF-8"/>
          <title>Welcome</title>       
</head>
<body>     
          <form action="home.html" novalidate="novalidate">
                   First Name <input type="text" name="fname"/><br/>
                   Email <input type="email" name="e1" required="required">                       <br/> 
                   <input type="submit" value="Login" name="sub">        
          </form>   
</body>
</html>

No comments:

Post a Comment