It is true that document.getElementById()
returns only one node and there is a reason for that: in proper html, id’s are unique and each id should only exist on one element. In your case, you need to perform 3 different queries by id:
document.addEventListener('wpcf7mailsent', function (event) {
const basicItemsSelection = document.getElementById("basicitems").value;
const wirelessItemsSelection = document.getElementById("wirelessitems").value;
const bluetoothItemsSelection = document.getElementById("bluetoothitems").value;
if (basicItemsSelection === 'Laptop' || wirelessItemsSelection === 'Chromebook'
|| bluetoothItemsSelection === 'Macbook') {
window.location = 'some_laptop_url';
} else if (basicItemsSelection === 'Keyboard' || wirelessItemsSelection === 'Wireless Keyboard'
|| bluetoothItemsSelection === 'Bluetooth Keyboard') {
window.location = 'some_keyboard_url';
} else {
window.location = 'some_other_url';
}
}, false);
The subsequent if statements reflect my understanding of your problem statement. If it’s not accurate, they should be easy to tweak.