Mailbox Verification
1, using function functions to achieve
Note: You need to add a property to the tag in code <input>: onblur= "Loginemailblur (this.value)"
function Loginemailblur (stremail) { var loginemail = $.trim ($ ("input[name= ' email ']"). Val ()); if (Loginemail = = NULL | | loginemail = = ' Mailbox ' | | loginemail = = "") { $ (". Smtwarning"). Empty (). Text ("Your email account forgot to enter"); } else{ if (Stremail.search (/^\w+ (-\w+) | ( \.\w+)) *\@[a-za-z0-9]+ ((\.| -) [a-za-z0-9]+] *\. [a-za-z0-9]+$/)! =-1) { $ (". Smtwarning"). empty (); return true; } else { $ (". Smtwarning"). Empty (). Text ("Please enter the correct mailbox format");}}}
2. Write in $ (document). Ready (function ())
Login Box Form Verify var $loginEmail = $ ("input[name= ' email ']"); var $stmWarning = $ (". smtwarning"); $loginEmail. blur (function () { var loginemail = $.trim ($ ("input[name= ' email ']"). Val ()); if (Loginemail = = NULL | | loginemail = = ' Mailbox ' | | loginemail = = ') { $stmWarning. Empty (). Text ("Your email account forgot to enter"); } else { if (Loginemail.search (/^\w+ (-\w+) | ( \.\w+)) *\@[a-za-z0-9]+ ((\.| -) [a-za-z0-9]+] *\. [a-za-z0-9]+$/)! =-1) { $stmWarning. empty (); return true; } else { $stmWarning. Empty (). Text ("Please enter the correct mailbox format");}} );
Form validation-Mailbox validation