Created
May 7, 2018 18:26
-
-
Save skipshean/2d83143e80557857eeb856b282b0ee63 to your computer and use it in GitHub Desktop.
Parse email address from URL parameter = email
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
<!-- Parse email address from URL parameter = email --> | |
<script> | |
var mail = document.querySelector('input#email_address'); | |
if (mail) { | |
var t = document.location.href.split('?')[1]; | |
if (t) { | |
var params = {}; | |
var lst = t.split('&'), l = lst.length; | |
for (var i = 0; i < l; i++) { | |
var p = lst[i].split('='); | |
if (!p[1]) continue; | |
params[p[0]] = p[1]; | |
} | |
if (params.mail) { | |
mail.value = params.mail; | |
} | |
} | |
} | |
</script> | |
<!-- /parse email --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment