Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

356
Views
Validate email id on keypress in jquery

I am trying to validate email id on keypress.. When the user enters invalid email id it should show a message enter valid email id.. If the user enter email(abc@gmail) it should display message enter correct email.. If the user enters (abc@gmail.com or co.in) it should allow to enter next field There is something wrong in regular expression i have entered.. Email doesnt get validated here is the script

<script type="text/javascript">
 $(function() {
             $("#sEmail").bind("keypress", function (event) {
                if (event.charCode != 0) {
                    var regex = new RegExp("^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
                    var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
                    if (!regex.test(key)) {
                      alert("Please enter Only email");
                        event.preventDefault();
                        return false;
                    }
                }
            });
            });
 </script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!