Skip to content

Instantly share code, notes, and snippets.

@betawax
Last active November 21, 2018 06:43
Show Gist options
  • Save betawax/2786517 to your computer and use it in GitHub Desktop.
Save betawax/2786517 to your computer and use it in GitHub Desktop.
Prevent the default action of hash-only links
$('[href=\\#]').click(function(e) {
e.preventDefault()
})
$(document).on('click', '[href=\\#]', function(e) {
e.preventDefault()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment