let retryCounter = 0 function overrideLinkDelegation() { const bookingLinks = window.document.querySelectorAll('a[href*="book.peek.com"]') if (retryCounter === 10) { return } else if (!bookingLinks.length) { setTimeout(overrideLinkDelegation, 500) } else { bookingLinks.forEach(function (domElement) { domElement.setAttribute('data-cancel-link', true) }); setTimeout(overrideLinkDelegation, 500) } retryCounter += 1 } overrideLinkDelegation()