Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

New input elements in HTML5

Tuesday, July 24th, 2012 by Servage

Have you already checked out the new input elements in HTML?

For many years developers have been forced to be creative when using input elements in forms. Creating a special input element might have involved the use of multiple other elements. For example a date and time or credit card field would contain multiple input fields or dropdowns.

In HTML5 some new input elements have been introduced, which standardizes and makes it easier to implement such inputs.

New available input types

  • color
  • date
  • datetime
  • datetime-local
  • email
  • month
  • number
  • range
  • search
  • tel
  • time
  • url
  • week

It’s very easy to use these types. It’s just like the old “text” or other types.

Example:

<input type="color" name="favcolor" />

The advantage of this is that supporting browsers will render the proper element, while older browsers will simply consider this a regular input element, and treat it like a text field. You can apply JavaScript and CSS as you see fit, to handle such situations.

New input elements in HTML5, 3.7 out of 5 based on 3 ratings
Categories: Tips & Tricks

Keywords: , ,

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.