Skip to content

Instantly share code, notes, and snippets.

@clayb
Forked from mejdzer/attach_query_string.js
Created July 21, 2014 18:12
Show Gist options
  • Save clayb/38f9a26a209a47eba5d6 to your computer and use it in GitHub Desktop.
Save clayb/38f9a26a209a47eba5d6 to your computer and use it in GitHub Desktop.
$('a').each(function() {
if (location.search.substr(1) !== '') {
query = location.search.substr(1);
symbol = $(this).attr('href').indexOf("?") == -1 ? '?' : '&';
$(this).attr('href', $(this).attr('href') + symbol + query);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment