It could be that you're binding the keydown events to specific elements and not the whole document as a whole?
I've simplified what you are trying to do and it works as a standalone piece of code:
$(document).keydown(function (e) {
if(e.which !== 9) return false;
if(e.shiftKey){
console.log('back Tab removed');
}else{
console.log("Tabin forward");
}
});
What are you trying to achieve? It looks like you just want to open the sub menu on tabbing, in which case you can massively simplifiy your code: http://jsfiddle.net/X3cLb/4/