Skip to content

Commit

Permalink
update javascript for clipboard button
Browse files Browse the repository at this point in the history
  • Loading branch information
pstaabp committed Jul 13, 2023
1 parent 7c3a349 commit 15ea3ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tutorial/templates/problem-template.mt
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
}

for (const btn of document.querySelectorAll('.clipboard-btn')) {
if (typeof navigator.clipboard === 'undefined') btn?.remove();
btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
if (navigator.clipboard) btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
else btn?.remove();
}
</script>
</body>
Expand Down

0 comments on commit 15ea3ed

Please sign in to comment.