Detect focus initiated by tab key?
I know you have accepted an answer but you could test the button pressed using the following: $(‘#detect’).on(‘focus’, function(e){ $(window).keyup(function (e) { var code = (e.keyCode ? e.keyCode : e.which); if (code == 9) { alert(‘I was tabbed!’); } }); }); http://jsfiddle.net/LPGLm/1/ Edit: change the listener around: $(window).keyup(function (e) { var code = (e.keyCode ? … Read more