Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bryanwillis
Created July 5, 2022 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanwillis/f2fa835f2bff914ca2f25d7b546d0707 to your computer and use it in GitHub Desktop.
Save bryanwillis/f2fa835f2bff914ca2f25d7b546d0707 to your computer and use it in GitHub Desktop.
function fillFormEmail(){
const input = document.getElementById('team_name-866'); // replace 'id' with id of email field
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString); //parse the query string
const teamname = urlParams.get('team'); // Store the parsed email address in variable
input.value = teamname; // fill the form with the email address
}
if (document.readyState === 'loading') { // Loading hasn't finished yet
document.addEventListener('DOMContentLoaded', fillFormEmail)
}
else { // `DOMContentLoaded` has already fired
fillFormEmail();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment