Created
August 20, 2012 14:07
-
-
Save 06b/3404571 to your computer and use it in GitHub Desktop.
Prevent sending the user back to the top of the page when using hash(#) within the anchor tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href$="#"]').on("click", function(e) { | |
e.preventDefault(); // to remove # from address bar | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment