Created
May 8, 2020 13:51
-
-
Save eunjae-lee/61b6fec8136e51fe7f6cbd5900cf0a3e to your computer and use it in GitHub Desktop.
attestation
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 fill(selector, value) { | |
document.querySelector(selector).value = value; | |
} | |
function fillForm({ | |
firstName, | |
lastName, | |
birthDate, | |
birthPlace, | |
address, | |
town, | |
postalCode, | |
reason, // "travail", "courses", "sante", "famille", "sport", "judiciaire", "missions" | |
}) { | |
fill('#field-firstname', firstName); | |
fill('#field-lastname', lastName); | |
fill('#field-birthday', birthDate); | |
fill('#field-lieunaissance', birthPlace); | |
fill('#field-address', address); | |
fill('#field-town', town); | |
fill('#field-zipcode', postalCode); | |
document.querySelector(`input[name=field-reason][value=${reason}]`).checked = true; | |
} | |
fillForm({ | |
firstName: 'Eunjae', | |
lastName: 'Lee', | |
birthDate: 'dd/mm/yyyy', | |
birthPlace: 'Séoul, Corée du Sud', | |
address: 'blah blah', | |
town: 'Blah Blah', | |
postalCode: '12345', | |
reason: 'courses', | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment