Skip to content

Instantly share code, notes, and snippets.

@pureugong
Created September 12, 2024 16:50
Show Gist options
  • Select an option

  • Save pureugong/bb7d62ad8352f7e389b7f67e175fef93 to your computer and use it in GitHub Desktop.

Select an option

Save pureugong/bb7d62ad8352f7e389b7f67e175fef93 to your computer and use it in GitHub Desktop.
// 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