Build responsive Buch & Bohne website from supplied design
showcase/deploy Live at https://showcase.andrefiedler.de/2608_BuB/
showcase/deploy Live at https://showcase.andrefiedler.de/2608_BuB/
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
const copyButton = document.querySelector('.copy-iban');
|
||||
const status = document.querySelector('#copy-status');
|
||||
|
||||
copyButton?.addEventListener('click', async () => {
|
||||
status.textContent = '';
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(copyButton.dataset.iban);
|
||||
status.textContent = 'Die IBAN wurde in die Zwischenablage kopiert.';
|
||||
copyButton.title = 'IBAN kopiert';
|
||||
} catch {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(copyButton);
|
||||
const selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
status.textContent = 'Bitte kopieren Sie die markierte IBAN.';
|
||||
copyButton.title = 'Bitte die markierte IBAN kopieren';
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user