So, i'm having some trouble getting my script to run IF the Tab key is pressed. After some quick googling, the charcode for Tab is 9. Also, while we're talking, is there any better ways of checking if a key is pressed without using charcodes? I'm asking because i keep getting the following Warning by firebug when using charcode:
The 'charCode' property of a keyup event should not be used. The value is meaningless.
Anyway, it still works, so that's not the problem. This is the code i use:
$('/* my inputs */').keyup(function(e) {
console.log('keyup called');
var code = e.keyCode || e.which;
if (code == '9') {
console.log('Tab pressed');
}
});
Using the above code the console is left blank, nothing is added (using Firebug). Of course i've tried actually doing stuff instead of logging text, but nothing executes. So can anyone see why this isn't working? Is there a better way of checking if a key is pressed?
Thanks in advance.