【问题标题】:Pattern attribute not accepting the email模式属性不接受电子邮件
【发布时间】:2013-06-26 06:44:20
【问题描述】:

我是 HTML5 新手......

我的问题是在将模式应用于电子邮件字段之后.. 并输入这样的电子邮件... user@gmail.com ,它不接受它...

它显示一些消息,如模式不匹配...

她是html的片段..

    <form name='f1' method="POST" action=""  >     
  <div id="fp">


        <span style="margin-left:-50px">Email:</span>&nbsp;&nbsp;
        <span><input  class="input" type="email" name="Email"   placeholder="Enter mailID" required pattern="^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$" ></span><br>


         <input type="submit"  name="submit" value="submit">

   </div>
  </form>    

任何建议都可以接受...

【问题讨论】:

    标签: html html-email email-validation html-input


    【解决方案1】:

    您的模式不允许使用小写字符。

    http://www.w3.org/TR/html5/forms.html#the-pattern-attribute

    模式是在禁用 ignoreCase 标志的情况下编译的。

    试试这个:pattern="^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2, 4}$"

    【讨论】:

      猜你喜欢
      • 2013-07-02
      • 2021-12-23
      • 1970-01-01
      • 1970-01-01
      • 2020-02-14
      • 1970-01-01
      • 2013-08-07
      • 1970-01-01
      • 2018-07-10
      相关资源
      最近更新 更多