Skip to content

Instantly share code, notes, and snippets.

@scottwater
Created March 16, 2021 00:10
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 scottwater/8223d0937374c734c79ae30279504dd2 to your computer and use it in GitHub Desktop.
Save scottwater/8223d0937374c734c79ae30279504dd2 to your computer and use it in GitHub Desktop.
Setting the email address based on a query string
<script>
document.addEventListener("DOMContentLoaded", () => {
const url = new URL(window.location)
const email = url.searchParams.get("email_address")
if (email) {
document.querySelectorAll("input[type='email']").forEach((el) => el.value = email);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment