I am facing an issue with capturing the "keydown" event and then changing the focus to the last active element.
Whenever I try to set the focus to a specific element within the function that captures the event, either the "input" element receives a "char" afterwards, or the entire "form" element captures the "enter" key and submits the form again.
Here is my current code:
http://jsfiddle.net/BluesM/KkexX/4/
I have found a solution but it feels a bit clunky. In the function that captures the event, I use the following:
setTimeout(function(){newFocus.focus(); }, 30);
where
newFocus
represents the element on which I want to set the focus. Is there a better way to achieve this?