jquery Mailbox Format Validation code:
In the form submission may need to use the mailbox verification code, the code is relatively simple, is the mailbox format judgment, if there is a difficulty may be about the use of regular expressions, here is not much to say, we can query, the following gives a section can be used to verify the code, copy paste can.
The code example is as follows:
<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.51texiao.cn/" /><title>Ant Tribe</title><Scripttype= "Text/javascript"src= "Mytest/jquery/jquery-1.8.3.js"></Script><Scripttype= "Text/javascript">$ (document). Ready (function(){ $("#bt"). Click (function(){ if($("#email1"). Val ()=="") {alert ("The mailbox cannot be empty"); return false; } varEmail=$("#email1"). Val (); if(!Email.match (/^ ([a-za-z0-9_-]) [email protected] ([a-za-z0-9_-]) + ((\.[ a-za-z0-9_-]{2,3}) $/) {alert ("The format is not correct! Please re-enter"); $("#email1"). focus (); } })})</Script></Head><Body> <formAction="#"> <inputtype= "text"ID= "Email1"> <inputtype= "button"value= "Submit"ID= "BT"> </form></Body></HTML>
The above code realizes the simple mailbox verification, the code assigns the value to be able to use after the paste.
The original address is: http://www.51texiao.cn/jqueryjiaocheng/2015/0427/249.html
jquery Mailbox Format Validation code