-
-
Save shankie-codes/a6d2285fc568868a17fa to your computer and use it in GitHub Desktop.
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
jQuery(function ($) { | |
//grab the entire query string | |
var query = document.location.search.replace('?', ''); | |
//extract each field/value pair | |
query = query.split('&'); | |
//run through each pair | |
for (var i = 0; i < query.length; i++) { | |
//split up the field/value pair into an array | |
var field = query[i].split("="); | |
//decode special characters | |
var cleanField = decodeURIComponent(field[1]); | |
//target the field and assign the cleaned up value | |
$("input[name='" + field[0] + "'], select[name='" + field[0] + "']").val(cleanField); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment