Created
March 16, 2021 00:10
-
-
Save scottwater/8223d0937374c734c79ae30279504dd2 to your computer and use it in GitHub Desktop.
Setting the email address based on a query string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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