console.log('RUNNING ELEVATE BOOKING'); document.addEventListener('DOMContentLoaded', () => { // --- 1. CONFIGURATION --- const airportApiUrl = 'https://tgdemo.pjsgroup.com/airports/opensearch/?format=json&limit=10&term=KTEB'; // --- 2. ELEMENT SELECTORS --- let fromDropdown = document.querySelector('[booking="from"]'); console.log(fromDropdown); let toDropdown = document.querySelector('[booking="to"]'); console.log(toDropdown); const departureDateInput = document.querySelector('[booking="departure"]'); const returnDateInput = document.querySelector('[booking="return"]'); const errorElement = document.querySelector('[booking="error"]'); // This is a critical check. If even one of these core elements is missing, we shouldn't proceed. if (!fromDropdown || !toDropdown || !departureDateInput) { console.error( 'Core booking elements (from, to, departure) are missing from the page. Script cannot initialize.' ); return; // Stop execution if essential elements are not found } // Verify that dropdowns are actually select elements if (fromDropdown.tagName !== 'SELECT' || toDropdown.tagName !== 'SELECT') { console.error( 'Elements with [booking="from"] and [booking="to"] must be