<!-- jQuery: Validating an email. --> $('#txtEmail').blur(function(e) { var sEmail = $('#txtEmail').val(); if ($.trim(sEmail).length == 0) { alert('Enter valid Email ID'); e.preventDefault(); } var filter = /^([/w-/.]+)@((/[[0-9]{1,3}/.[0-9]{1,3}/.[0-9]{1,3}/.)|(([/w-]+/.)+))([a-zA-Z] {2,4}|[0-9]{1,3})(/]?)$/; if (filter.test(sEmail)) { alert('Valid Email'); } else { alert('Email not valid'); e.preventDefault(); } }); <!-- HTML: Validating an email--> <asp:TextBox id="txtEmail" runat="server" />
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/8652.html