Last active
June 30, 2017 13:40
-
-
Save DZuz14/de7584165e21845d6d8b48871adce9c1 to your computer and use it in GitHub Desktop.
Query string value extraction
This file contains 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
function urlExtractor(url) { | |
url = decodeURIComponent(url); | |
var charIndex = url.indexOf('='); | |
if(charIndex < 0) { | |
return; | |
} | |
var sliced = url.slice(charIndex).substring(1).replace(/_/g, ' '); | |
var inputField = document.getElementById('lead_source'); | |
inputField.value = sliced; | |
return; | |
} | |
urlExtractor(window.location.href); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment