0

Please sombody tell me .. i hv an input box like this

<td > 
      <input type="text" name="emailid" id="emailid" onBlur="checkMail(this)" value="emailId" onFocus="this.value=''">
      @domain.com</td>

And the checkmail function is like this

//function to check email address format
function checkMail(emailid) {
  var mail = emailid.value;
  var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-] {1}[a-z0-9]+)*[\.]{1}(com|ca|net|org|fr|in|us|gov|qc.ca|gouv.qc.ca)$', 'i');
 
  if(!reg.test(mail) || mail == "")
  {
    alert("Please input a valid Email address");
	document.edit_email.emailid.value='';
	document.edit_email.emailid.focus()
    return false;
  }
  else {
      return true;    
  }
}

Now problem is as u can see .. i hav to check just "EMAIL ID" not the full "Email address".. i cud not be successful to edit the JS function.. plz help me !! :(

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by paulrajj
0

Hi,

Just replace this with existing regular expression pattern.

var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*$', 'i');
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.