sS hjs_redirectRandomKeystrokesToAutofocusField() { ret hjs([[ $(document).on('keydown', function(e) { var nodeName = e.target.nodeName; if ( 'INPUT' == nodeName || 'TEXTAREA' == nodeName ) return; var key = event.which; if (key == 33 || key == 34) return; // pg up/dn $('[autofocus]').val('').trigger('focus'); }); ]]); }