After much trial and head scratching while debugging a custom text input *hint* dropdown (much like the gmail email address hinting) I discovered how to prevent arrow key action without returning the function before the desired time:
Thank you: http://www.webdeveloper.com/forum/showthread.php?t=93262
window.event.returnValue=false;
or, rather:
if (document.all) {
window.event.returnValue=false;
} else if (e.cancelable) {
e.preventDefault();
}
Without this the up and down arrow keys to select hints also move the cursor the beginning or end of the input field (especially in Safari).
I found other (less effective) work-arounds which worked in all browsers except Safari on PC. So this little tid mit was a life saver indeed!
That's it! It has almost the same effect as "return false;" without ending your script. or, rather:
if (document.all) {
window.event.returnValue=false;
} else if (e.cancelable) {
e.preventDefault();
}
Without this the up and down arrow keys to select hints also move the cursor the beginning or end of the input field (especially in Safari).
I found other (less effective) work-arounds which worked in all browsers except Safari on PC. So this little tid mit was a life saver indeed!
Thank you: http://www.webdeveloper.com/forum/showthread.php?t=93262