In this blog I will share the details about Html5 new form attributes. There are 14 new attributes that we’ll be looking at in this article
All modern browsers support the attribute and, like placeholder, browsers that don’t support simply ignore it
autocomplete attribute allows users complete forms based on earlier input. This attribute is there science IE5, but has finally been put as a part of HTML5. The default state for for this attribute is set to “on”. It means we dont have to use this explicitly untill its required.
This attribute explain what is expected, I still remember that i have used jquery validation plugin for same reason. Adding this attribute means enforce user to enter the data for mandetory field. In most of the modern browser it shows the popup icon that shows error message, In safari browser it onlys puts focus on field where as it doest not show’s error message like other browsers.
The list attribute enables the user to associate a list of options with a particular field. These are predefined options value of the list attribute must be the same as the ID of a datalist element. The datalist element is new in HTML5 and represents a predefined list of options for form controls. It works in a similar way to the in-browser search boxes that autocomplete as you type.
This attribute allows user to upload multiple files using input type file html elememnt.
As name says, If you add this attribute for form tag, it says no validation is required for this form.
We can add this attribute to input type submit or image, on submit event it will enforce to validate the form for required element.
Classic feature, we can add form attribute inside elements like input type submit, select, text,etc. Using form means that the element doesn’t need to be a child of the associated form and can be moved away from it in the source.
11. formaction , 12. formenctype 13. formmethod 14. formtarget
We can add these attributes for input type elements, if available then these values will have preference otherwise form tag values will be used.