【发布时间】:2016-06-02 12:07:28
【问题描述】:
我正在寻找电子邮件表单字段上的 javascript 验证。在提交时,我想验证电子邮件是否包含@specifieddomain.com,然后提交其他错误消息“请使用您的公司电子邮件”
<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<p><form id="microsubs_form" method="post" action="/" class="" >
<input type="text" id="ms_firstName" required="true" placeholder="First Name" style="margin-bottom:20px;">
<input type="text" id="ms_lastName" required="true" style="float:right; alignment-adjust:central; clear:right" placeholder="Last Name" style="margin-bottom:20px;">
<input type="email" id="ms_email" required="true" style="float:left;" placeholder="Corporate Email address">
<input type="number" id="ms_telephoneNumber" required="true" style="float:right; alignment-adjust:central; clear:right">
</form></p>
<p></p>
</div>
</div>
谢谢
【问题讨论】:
-
HTML:
<input pattern="\\w+@specifieddomain\\.com"JS:emailValue.endsWith(@specifieddomain.com); -
这应该不是一个困难的网络搜索,您应该在此处提问之前进行基础研究
-
@charlietfl 是的,这是一个简单的网络搜索,但我是一名软件工程师而不是开发人员,并且有一个解决方案,只是看看那里最好的,因为有许多不同的实现。
-
那么正确的做法是展示你已经拥有的东西......不要像没有研究过一样问。
标签: javascript jquery html