HTML5 INPUT element type: Email and URL Introduction

Source: Internet
Author: User
Tags regular expression

We've discussed some HTML5 improvements, such as placeholder,prefetching and WebStorage, and here are two new INPUT element types: email and URL. Let's follow the code to see their benefits:

Syntax format:

The new input type attribute replaces text with an email or URL:

The code is as follows:

<!--email, non-@ + @ + non-@ symbol, you can also use the other,

For example [a-za-z0-9]{3,30}@[a-za-z0-9]+w*. (com|cn|org|net)-->

<input type= "Email" pattern= "[^@]*@[^@]*" value= "] >

<!--URL-->

<input type= "url" value= "" >

Using the pattern attribute field peculiar to HTML5, you can provide a regular expression to verify the format of the email and URL addresses, and we will discuss this topic in another article.

Advantages

-can customize special CSS style, Input[type=email]

-can customize special CSS style, Input[type=url]

-More semantic definitions can be done

-Mobile Application Compatibility: Mobile browser will be the email and URL pop-up special keyboard, without user manual switch.

At first I was disgusted with adding extra input type, but after deep thinking I thought it was a good move to improve the user experience, don't you think?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.