Skip to main content

New HTML 5 Input Tags

Submitted by srinivasulu on Wed, 06/26/2019 - 17:42
HTML Tags

In this article, we are going to learn about all the Input tags including the latest one added in the recent version of HTML 5. It is really fascinating to see that the new tags are making the life of the developers quite easy. Initially we were totally dependent on the Javascript frameworks to get those functionalities, but now all we have to do is just declare the right attribute for the input type and we are good to go. Unlike the javascript framework they are superfast and we can play with it like anything else. Here are the list of newly introduced HTML Input tags.

Color

This tag will let the user to choose a color from the color exactly like the desktop applications. The input tag <input type='color' > defines a color picker. The default value is #000000 (black). The value must be in seven-character hexadecimal notation

Date

The input tag <input type="date"> lets you select a date, initially we were dependent on the datepicker of javascript frameworks like jQuery etc. But now HTML 5 comes with an inbuild feature of datepicker.

Date Time Local

The input tag <input type="datetime-local"> specifies a date and time input field, with no time zone. Depending on browser support, a date picker can show up in the input field.

Month

The <input type="month"> allows the user to select a month and year. Depending on browser support, a date picker can show up in the input field.

Number

The <input type="number"> defines a numeric input field. You can also set restrictions on what numbers are accepted.

Range

The <input type="range"> defines a control for entering a number whose exact value is not important (like a slider control). Default range is 0 to 100. However, you can set restrictions on what numbers are accepted with the min, max, and step attributes:

Search

The <input type="search"> is used for search fields (a search field behaves like a regular text field).

URL

The <input type="url"> is used for input fields that should contain a URL address.Depending on browser support, the url field can be automatically validated when submitted. Some smartphones recognize the url type, and adds ".com" to the keyboard to match url input.

Week

The <input type="week"> allows the user to select a week and year.Depending on browser support, a date picker can show up in the input field.

Following are the input tags demonstrated with their outputs.
Tags

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Simple Textbox