Skip to content

Instantly share code, notes, and snippets.

@JacobLett
Created September 17, 2020 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JacobLett/781058e9af559cfc9091bffd2ed1b5ed to your computer and use it in GitHub Desktop.
Save JacobLett/781058e9af559cfc9091bffd2ed1b5ed to your computer and use it in GitHub Desktop.
Grab URL parameters script
// Apply URL parameters to Register Button if present
var changeTarget = document.getElementById('registerBtn');
var params = window.location.search;
var _href = changeTarget.href;
// Does the page have url parameters ?
if (params) {
// yes - add them to the iframe src
changeTarget.href = _href+params;
console.log("url params = " + params);
} else {
// no - use a generic iframe src
changeTarget.href = _href;
}
<a href="/en/event-registration" data-type="btn" class="img-container" style="position: relative;" id="registerBtn"><button class="btn white-btn">Register Now</button></a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment