for example, I want the textfield input number only. my idea is when the user typing, it will call a javascript to check whether it is valid, if it is not valid, I delete the text which is just entered. But I think it is very complex to do so. Is there any simple way to do so?
A:
The script to do this is here. It's a pretty common requirement.
http://javascript.internet.com/forms/validate-numeric-only.html
David Stratton
2009-10-27 12:38:33
it have a bug... try to hold down the key.... it still can display the letter.
Ted Wong
2009-10-27 13:04:58
A:
JQuery Masking could be a good choice: http://digitalbush.com/projects/masked-input-plugin/
o.k.w
2009-10-27 12:42:44
A:
I think, like o.k.w said, jQuery Masking would be a good choice because of 2 things:
jQuery is solid and fast
Masking is more user friendly than just deleting user input on the fly without any notification. Masking gives them a graphical reference of what type of input is expected and what the input might look like.
MysticEarth
2009-10-27 12:47:01