My problem is very simple, but I can’t find an equally simple solution. I have a text field that is validated via the jQuery validation plugin, and I want to make sure that the value entered is NOT a number. What is the simplest way to do so?
Thanks in advance! 🙂
My problem is very simple, but I can’t find an equally simple solution. I
Share
I didn’t work with jQuery validator yet, but I guess you can provide your own validation function.
You could do:
Edit: Apparently,
isNaNaccepts a string too, soisNaN(value)suffices.If you want to ensure that the input does not contain any digit (which is different from the input not being a number), then you would have to use regular expressions:
P.S.: Also works without jQuery 😉