How to make recognize submit input for gap?

0 like 0 dislike
6 views
There is a field tagged which should not contain spaces i.e., it should be one word,sometimes users are stupid and try to type in a few words. The challenge when pressing the space bar to do a form submission or override pressing the space bar as pressing enter. You can use jQuery
by | 6 views

1 Answer

0 like 0 dislike
myForm.addEventListener('keypress', function(evt){ if (evt.which == 32 || evt.keyCode == 32) { evt.preventDefault() myForm.submit() } })
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
33,932 users