Skip to content

Instantly share code, notes, and snippets.

@usmanity
Last active November 9, 2019 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usmanity/370ca08ea69db5355a85e111d2ecf911 to your computer and use it in GitHub Desktop.
Save usmanity/370ca08ea69db5355a85e111d2ecf911 to your computer and use it in GitHub Desktop.
move to the next page
/* this version wasn't working
$(document).on('keydown', function(e) {
if (e.key == "ArrowRight" || e.key == " ") {
let next = $('a').filter((b, anchor) => $(anchor).text().includes('next') )
next.click();
}
});
*/
// working version
$(document).on('keydown', function(e) {if (e.key == "ArrowRight" || e.key == " ") {let next = $('a').filter((b, anchor) => $(anchor).text().includes('next') ); console.log(next); location = next[0].href;}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment