Skip to content

Instantly share code, notes, and snippets.

@wihodges
Created April 26, 2012 19:17
Show Gist options
  • Save wihodges/2502199 to your computer and use it in GitHub Desktop.
Save wihodges/2502199 to your computer and use it in GitHub Desktop.
Append all urls with current page URL parameters - JS
$(document).ready(function(){
elements = $('.openURL');
passMe = window.location.href.slice(window.location.href.indexOf('?'));
elements.each(function() {
url = $(this).attr("href");
newURL = url + passMe;
$(this).attr("href", newURL);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment