Question
navigator.clipboard.writeText does not work in Live Preview
I have a button that copies the content of a caption to clipboard with the below code.
const element = document.getElementById("txtCaption");
let text = element.getAttribute("aria-label");
alert(text);
navigator.clipboard.writeText(text);
This works fines in project preview but does not work in Live Preview and poublished output. The issue is with the last line. Can anyony help please?
