my script works, but I don’t understand how to make it NOT run functions when these keys are pressed in textarea / input. aka: trigger an event when the user presses this key if the user is not in the text box / input.
$('body').keyup(function (event) { var direction = null; if (event.keyCode == 37) { $('#wrapper').fadeOut(500) } else if (event.keyCode == 39) { $('html,body').animate({scrollTop: $('body').offset().top}, {duration: 1500, easing: 'easeInOutQuart'} ) return false; } })
jquery onkeyup
android.nick
source share