111
rated 0 times
[
113]
[
2]
/ answers: 1 / hits: 23596
/ 13 Years ago, wed, july 27, 2011, 12:00:00
I am doing a street Address validation, in stret address validation text field should allow all the characters and Special characters.
To allow all the special characters, I have used the following way.
Is there a better way to allow all the special characters?
function isAcceptedChar_StAddress(s)
{
if (s == ',' || s == '#' || s == '-' || s == '/' || s == ||
s == '!' || s == '@' || s == '$' || s == % || s == '^' ||
s == '*' || s == '(' || s == ) || s == { || s == '}' ||
s == '|' || s == '[' || s == ] || s == \)
{
return true;
}
else
{
return false;
}
}
In the above code, i am comparing each character if it is matching I am returning true, else return false
More From » javascript