I'm making a filter tool using .keyup()
To make it look a bit nicer, I have the table fadeOut before the non-matching rows are hidden and then fadeIn once it's done.
$('tbody').animate({
opacity: 0
}, 300,function(){
$('tbody tr').addClass('filter_hide');
$('tbody tr td.'+f+':icontains("'+v+'")').parents('tr').removeClass('filter_hide');
$('.entry_total').text(count);
setTimeout(function(){
changeShow(1);
}, 400)
});
note: :icontains
is just a case-insensitive version of :contains
. v
is the val() of the changed input. changeShow()
updates my pagination with the new results only, and brings the table visible again
It all works great except one thing: the code is triggered when I press shift, caps, tab and so on, so the table fades out and fades back in again for these key presses, which looks bad.
How can I exclude these 'non-printing' key presses from firing the function?