HTML5 Email Input Pattern Attribute

前端 未结 17 987
时光取名叫无心
时光取名叫无心 2020-11-30 20:09

I’m trying to make a html5 form that contains one email input, one check box input, and one submit input. I\'m trying to use the pattern attribute for the email input but I

17条回答
  •  失恋的感觉
    2020-11-30 20:41

    In HTML5 you can use the new 'email' type: http://www.w3.org/TR/html-markup/input.email.html

    For example:

    
    

    If the browser implements HTML5 it will make sure that the user has entered a valid email address in the field. Note that if the browser doesn't implement HTML5, it will be treated like a 'text' type, ie:

    
    

提交回复
热议问题