T
T
timtimIT2015-09-25 18:55:02
JavaScript
timtimIT, 2015-09-25 18:55:02

Is the code correct?

Why doesn't the following code work? Does not respond to condition.

if (string3.search(/\w{2,}@.\w{2,}.\w{2,}/) == -1 && string3.search(/\W/) != -1  ){
alert("Электронная почта введена не верно!");
      return false;	
  }

When was:
if (string3.search(/\w{2,}@.\w{2,}.\w{2,}/) == -1) {
 alert("Электронная почта введена не верно!");
      return false;	
  }

everything worked...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Misha Kogan, 2015-09-25
@Kogan4ik

try to take two different conditions in brackets

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question