javascript - jquery regexp email validation -
possible duplicate:
how use regular expression validate email addresses?
i have tried standard options, none have helped email: blablabla-k@kiev.foxtrot.ua
client function custom validator in asp.net webforms:
function requiredfields(source, args) { var reg = new regexp('/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/'); var email = $('#tbemail').val(); args.isvalid = ((email.length > 0) && (reg.test(email))); }
<script type="text/javascript"> $(document).ready(function() { $('#txtemail').blur(function() { if(validateemail('txtemail')) { alert('email valid'); } else { alert('invalid email address'); } }); }); function validateemail(txtemail){ var = document.getelementbyid(txtemail).value; var filter = /^((\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*?)\s*;?\s*)+/; if(filter.test(a)){ return true; } else{ return false; } } </script> email address:
< input type='text' id='txtemail' /> for live demo click here1
Comments
Post a Comment