Created
August 2, 2016 19:43
-
-
Save falonofthetower/05f9c3ff11a8b75152b0df1bc26f0ff9 to your computer and use it in GitHub Desktop.
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
(function( window ) { | |
"use strict"; | |
var document = window.document, | |
fieldValueMap = { | |
"title" : "Ms." | |
, "name" : "JonSnow" | |
, "fullname" : "Jon Snow" | |
, "firstname" : "Jon" | |
, "lastname" : "Snow" | |
, "email" : "[email protected]" | |
, "username" : "Stark" | |
, "password" : "wintercomes" | |
, "confirmation": "wintercomes" | |
, "position" : "Lord Commander" | |
, "zipcode" : "69523" | |
, "country" : "United States" | |
, "state" : "North Dakota" | |
, "city" : "Wichita" | |
, "address" : "3153 auburn ave" | |
, "phone" : "(135)-773-2494" | |
, "cell" : "(327)-710-3077" | |
, "SSN" : "966-49-5276" | |
, "company" : "Night Watch" | |
, "nationality" : "Westerosi" | |
, "comment" : "This is a test data. Please, ignore it." | |
, "jobtitle" : "Crow" | |
, "experiance" : "Veteran (5+)" | |
, "site_link" : "jon.winterfell.we" | |
, "how" : "other (Please specify)" | |
, "specified" : "This is a test data. Please, ignore it." | |
, "publication" : "Westeros Daily" | |
}; | |
Object.keys( fieldValueMap ).forEach(function( name ){ | |
var input = document.querySelector( "form input[name='" + name + "']" ) | |
|| document.querySelector( "form select[name='" + name + "']" ) | |
|| document.querySelector( "form textarea[name='" + name + "']" ); | |
input && input.type !== "hidden" && ( input.value = fieldValueMap[ name ] ); | |
}); | |
})( window ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment