<body>
<div>Sample div</div>
<input type='text'/>
</body>
$(document).delegate('body *:not(input)', 'keyup', function(e){
if((e.keyCode || e.which) == 39){ //right arrow
$('#next_image').click();
}
if((e.keyCode || e.which) == 37){ //left arrow
$('#prev_image').click();
}
}
I'm using jQuery Cycle library to setup slideshow. It's more like a photo album, where you can use keyboard shortcuts to do some stuff. So, the slideshow is the whole page, which also contains input fields. Hence, when you are writing a text inside of input field and try to move cursor with keyboard (left and right arrow buttons), it would fire the event and scroll to the next/prev image.
Any ideas on how to enable keyup events on everything BUT the input field? Obviously, current selector doesn't work.