Simple, I want to build an editor that only accept numbers, as I do, you can use javascript on change?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes you can use javascript, but it gets dicey. You have to trap every keystroke so stay away from things like Jquery which only slow it down. Also keypad is different from number keys so you have to be aware of those. Also you have to pass through things like tab, backspace, space ( sometimes but not always ), del key, insert etc. not to mention the period on the keyboard and on the keypad if you are doing fixed point decimals.
This is one of the major weaknesses of the DOM model and HTML so you ahve to code around it. Google for “javascript+keycode” and you will find lots of examples.