bind the event to the document
instead:
$(document).bind('keyup', function(e) {
alert('testing');
});
You can make almost any node receive keyboard events. In "modern" browsers, you can setup a tabIndex
. After that the event is focusable.
$(document.body).attr('tabIndex', 1).bind('keyup', function(e) {
alert('testing');
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…