Skip to content

Instantly share code, notes, and snippets.

@mejdzer
Last active August 29, 2015 14:04
Show Gist options
  • Save mejdzer/2678458c6ff7c87fdae1 to your computer and use it in GitHub Desktop.
Save mejdzer/2678458c6ff7c87fdae1 to your computer and use it in GitHub Desktop.
Attach a query string to the links on the page
$('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