Saturday, 23 June 2012

How to add Email text box in HTML5 Form

HTML5 introduces an email text box. This text box checks for a valid email address. Instead of TYPE="Text" you use TYPE="Email". Here's the code to try:

<FORM>

<INPUT TYPE="Email" PLACEHOLDER="Enter your email address">

<P>
<INPUT TYPE="Submit" VALUE="Submit">

</FORM>

An older browser that doesn't recognise TYPE="Email" will just display a normal text box. So you may as well use the new email TYPE right now, if you need to.

Again, though, browser support is patchy. Only Google Chrome and Firefox support the Email text box. Even then, Firefox lets meme@memecom through, when it should be .com on the end. (Chrome picks this error up and doesn't submit the form.)

No comments:

Post a Comment