0

I need to validate email id using bootstrap I tried many ways but it is not validating.

<label class=".col-xs-12 .col-sm-6 .col-lg-8"  style="margin-left:-1%; margin-right:10%">Email</label>
<input name="Email" class="for" id="email" placeholder="EMail ID" required/>
Amit Kumar
  • 318
  • 2
  • 14
udhay
  • 101
  • 1
  • 10

1 Answers1

0
<label class=".col-xs-12 .col-sm-6 .col-lg-8"  style="margin-left:-1%; margin-right:10%">Email</label>
<input name="Email" class="for" id="email" placeholder="EMail ID" required onblur=ValidateEmail(this.value)/>

// in script section

function ValidateEmail(mail)   
{  
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail))  
  {  
    return (true)  
  } else {
    alert("You have entered an invalid email address!")  
    return (false)  
 }
}

Amit Kumar
  • 318
  • 2
  • 14