Click here to Skip to main content
16,017,376 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add regular expression validation for a email send dialog box..i have already added required one..and the code is here..

@Html.TextBox("Email", "", new { id = "UserEmail", @required = true })
@Html.ValidationMessageFor(m=>m.Contact_EmailID)
<input type="submit" value="Send" id="submit" />

and jqery code is:
C#
$(document).ready(function () {

       $('#CountryNameD').addClass('ddl');
       $("#btnPrint").css("display", " ");

       $('#SendEmailDialog').dialog({
           autoOpen: false,
           width: '300',
           height: '180',
           resizable: false,
           close: function (ev, ui) {
               $(".modalOverlay").remove();
           }
       });


now add validation using jqery..need your help guys..thanks in advance.
Posted

1 solution

Try

C#
function IsEmail(email) {
  var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  return regex.test(email);
}


Find more Here[^]
 
Share this answer
 
Comments
Member 11012889 19-Sep-14 2:16am    
i have already used this code..But it's showing error for @ symbol...it's not accepting @.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900