I really like the simplicity of Ilya Volodin's suggestion, but I would install an event handler in a script and not embed it in html:
var textFocus = false; $("textbox").focus(function() { textFocus = true; }); $("textbox").blur(function() { textFocus = false; }); function navKeys() { if (textFocus) { return false; } else { ...... } }
This would be even simpler if jquery had :focus as a selector.
function navKeys() { if ($("textbox:focus") { return false; } else { ...... } }
But this is only a hypothetical code at the moment.
source share