peps03
asked on
Only allow numbers, dashes (-) and comma's (,) in text field
Hi,
I would like to only allow numbers, dashes (-) and comma's (,) to be entered into a text field.
How should i do this? Without the use of jQuery please.
Thanks!
I would like to only allow numbers, dashes (-) and comma's (,) to be entered into a text field.
How should i do this? Without the use of jQuery please.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!!!
var someName = document.getElementById("s
if(/^[-,a-z0-9-]+$/i.test(
{
alert('Name can only be alpha numeric with hypen or comma.');
return;
}