Tech Sharing

Tech Sharing


Disabled certain key to be entered using javascript

By on June 13, 2009

There is always the good way to prevent and verify the using enter data, especially for each text box or text area.

The following is script use the event object to check on the key code that the user enter, return false to prevent user to enter.

Disabled space to be enter in javascript

onKeypress=”if (event.keyCode == 32) event.returnValue = false;”


Only allow number and . to be enter in javascript

onkeypress=”if (event.keyCode < 47 || event.keyCode /> 57) event.returnValue = false;”


Website Pin Facebook Twitter Myspace Friendfeed Technorati Digg Google StumbleUpon Premium Responsive


No Responses to “Disabled certain key to be entered using javascript”

Write a Comment

Captcha * Time limit is exhausted. Please reload CAPTCHA.

%d bloggers like this: