Validating a textfield to accept only numeric data...

icklejez

Member
Jan 12, 2007
50
0
0
Ive got a text field 'num1' that i want to validate so that it pops up a message when theres no numbers in it using Javascript...

all the tutorials on the web are far too complex and i was wondering if someone could help me understand what i need to put in my html document.

Thanks

 

Jeraden

Platinum Member
Oct 9, 1999
2,518
1
76
Here's the one I use on one of our pages at our company, probably more elegant ways to do it, but this is the one I found that worked a long time ago.
Whatever function calls this, have it output an alert saying it wasn't numeric if the function returns 0.