To get rid of a certain text field # city
, I want to remove that error message
This letter works with numbers and points, but I can not find it to work with a comma.
Code:
$ ('Input # city'). Blurring (work () {var cityc = $ (this) .val (); if (/ ^ [az 0-9]. '] {2,25} $ / i.test (Cityc)) $ $ (this) .removeClass ('invalid'); $ ('span.cityerror'). RemoveClass ('active');}});
Therefore, if an error message exists, and if the value of the text contains numbers or numbers of letters, the error message disappears, but if a comma is not it.
I tried to modify the line in such a question:
if (/ ^ [az 0-9., '] {2,25} $ / i .test (cityc) {{Code> As you can see I have added a comma in the expression, but it will still not get staining if the value of the input is included in a comma?
Update:
So if I enter city
for example, the message disappears, but city,
Or city,
, it is not.
I'm not a regex expert, but
you can try it :
if (/ ^ ([a-z0-9] + [. ',]] [A-z0- 9] *) + $ / I.test (cityc)) { ...}
edit
What about it: if (/ ^ [A-za-J 0- 9. ',] + $ /. Exam (City)) {...}
Comments
Post a Comment