Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

WDS18 - Little More About HTML Forms

In the last article we learned:
  • Input type Reset
  • Input type Password
  • Input type Color
  • Input type Date
  • Input type Email
  • Input type Checkbox
Including the first 3 input fields learned in the first article about HTML forms, now we can use 9 various types of input fields in our forms. There are more fields, some of which are not very important but you can check all other fields on Internet, but what we have learned about input fields is more than enough.
Now let's see some input attributes so that we can customise our inputs.

The value Attribute

It is used to specify the initial value of an input field.

The readonly Attribute

It is used to specify that input field can not be edited that is it is fixed.

The disabled Attribute

It is used to disable specific input field. The disabled input field can not be clicked or used. Its value will not be sent while submitting form.

The size Attribute

It specifies size of input field in number of characters. Default is 20 characters.

The maxlength Attribute

It specifies maximum allowed length for the input field.

The autocomplete Attribute

This HTML5 special attribute enables browser to automatically complete input based on previously entered values.

The min and max Attributes

This attribute is available for folloeing input fields:
  • number
  • range
  • date

The placeholder Attribute

It is used to specify hint in input field or sample input user can enter.

The required Attribute

It is used to specify that form can not be submitted without

Although I have not shown live code examples, I encourage you to try this example out. The above-mentioned input attributes are more than enough and can be applied to various types of inputs(excluding some special like min and max).
That's all for today. In the next article, we will some more things about forms and will most probably finish HTML forms. Till then #keepCoding.

This post first appeared on The Coding Express, please read the originial post: here

Share the post

WDS18 - Little More About HTML Forms


Subscribe to The Coding Express

Get updates delivered right to your inbox!

Thank you for your subscription