Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
182
rated 0 times [  185] [ 3]  / answers: 1 / hits: 109083  / 11 Years ago, thu, september 26, 2013, 12:00:00

Is it possible to not allow a blank character / space in a input form like below?



<input type=text value= maxlength=30 name=email class=formfield w0>

More From » forms

 Answers
39

Check this Fiddle. Relevant code:





 $(function() {
$('#input1').on('keypress', function(e) {
if (e.which == 32){
console.log('Space Detected');
return false;
}
});
});

<script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js></script>

<input type=text id=input1 />




[#75412] Wednesday, September 25, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
raynamadilynl

Total Points: 653
Total Questions: 110
Total Answers: 98

Location: Honduras
Member since Sat, Jul 24, 2021
3 Years ago
raynamadilynl questions
;