HTML5电子邮件验证 [英] HTML5 Email Validation
本文介绍了HTML5电子邮件验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以在用户输入后验证电子邮件吗?如果用户输入了他/她的电子邮件地址的错误形式,则无JS显示消息。
=emailpattern =[^ @] * @ [^ @] *placeholder =输入您的电子邮件>< input type =submitvalue =提交>
解决方案
在HTML5中,您可以这样做:
< form>
< input type =emailplaceholder =输入您的电子邮件>
< input type =submitvalue =提交>
< / form>
当用户按下提交时,它会自动显示如下错误消息:
It is said "With HTML5, we need no more js or a server side code to check if the user's input is a valid email or url address"
How can I validate email after a user enter? and without JS how to display a message if the user enter a wrong form of his/her email address.
<input type="email" pattern="[^ @]*@[^ @]*" placeholder="Enter your email">
<input type="submit" value="Submit">
解决方案
In HTML5 you can do like this:
<form>
<input type="email" placeholder="Enter your email">
<input type="submit" value="Submit">
</form>
And when the user press submit, it automatically shows an error message like:
这篇关于HTML5电子邮件验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文