not allow space in input field code example
Example 1: java script how to not allow soace
$(function() {
$('#input1').on('keypress', function(e) {
if (e.which == 32){
console.log('Space Detected');
return false;
}
});
});
Example 2: not allowed space in input field
$('input').keypress(function( e ) {
if(e.which === 32)
return false;
});