Disable Space bar in a text field

Submitted by:Jhon Jhon

Date added:26 January, 2013

Category:jQuery

Once the keycode of the spacebar is detected, it returns false which disallow the entering of space.

Tags: disable space bar

Code Snippet:

$('input.nospace').keydown(function(e) {

// alert (e.keyCode);

if (e.keyCode == 32) {
return false;
}
});
 
 

Comments