I have an iPad webapp with a big <form> at some point. Each input in it has functions that control values, both for keyUp events and for Blur.
The fact is that if the user accidentally pressed the "GO" button during input (considered by pressing "enter"), the form is submitted. I would like to intercept this aspect and trigger the onBlur () event of the focused element.
At the moment I have this:
load(){ document.addEventListener("keydown",logPressedKeys,false); } function logPressedKeys(e) { console.log(e.keyCode); if (e.keyCode==13) { console.log('Enter spotted: prevent!'); e.preventDefault();
Do you have any tips / ideas / improvements?
Nota bene: There must be at least one input focused on the iPad keyboard to pop out.
javascript ipad
monsieur_h
source share