Disabled certain key to be entered using javascript

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;”


Leave a Reply

google.com, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: