Created
September 12, 2024 16:50
-
-
Save pureugong/bb7d62ad8352f7e389b7f67e175fef93 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
| // Names array (last name first, then first name) | |
| const names = [ | |
| { lastName: 'JO', firstName: '' }, | |
| { lastName: 'IM', firstName: '' }, | |
| { lastName: 'LEE', firstName: '' }, | |
| { lastName: 'LIM', firstName: '' }, | |
| { lastName: 'SUNG', firstName: '' }, | |
| { lastName: 'LIM', firstName: '' } | |
| ]; | |
| // Function to input names and click 'Add' button | |
| function addNames() { | |
| const lastNameInput = document.getElementById('paxLastName'); | |
| const firstNameInput = document.getElementById('paxFirstName'); | |
| const addPaxBtn = document.getElementById('addPaxBtn'); | |
| names.forEach((name, index) => { | |
| setTimeout(() => { | |
| lastNameInput.value = name.lastName; // Input last name | |
| firstNameInput.value = name.firstName; // Input first name | |
| addPaxBtn.click(); // Click the 'Add' button | |
| }, index * 1000); // Wait 1 second between each entry | |
| }); | |
| } | |
| // Run the function | |
| addNames(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment