Files
e-ticket/assets/modules/copy-url.js
2026-03-20 21:37:12 +01:00

14 lines
449 B
JavaScript

export function initCopyUrl() {
const btn = document.getElementById('copy-url-btn')
if (!btn) return
const url = document.getElementById('event-url')?.textContent?.trim()
if (!url) return
btn.addEventListener('click', () => {
globalThis.navigator.clipboard.writeText(url).then(() => {
btn.textContent = 'Copie !'
setTimeout(() => { btn.textContent = 'Copier le lien' }, 2000)
})
})
}