$clipboard(dataelement) gives writeText error
ralphjsmit opened this issue · 1 comments
ralphjsmit commented
I'm implementing the clipboard on my website, but I can't get it to work. I did it like this:
<div x-data="{ markup: 'COPYME' }">
<span @click="$clipboard(markup)" class="my-3 font-sans ...">Click to copy</span>
</div>
When I try to use it, it gives an error. My Chrome devtools gives the following error (see below). I concluded that the @click
is working and that the $clipboard()
property is working too (as the error occurred in the alpine clipboard file). Am I doing something wrong or is this a bug?
Many thanks!
ralphjsmit commented
Update:
Just after I posted this, I realised that my site wasn't using HTTPS. I remembered reading somewhere that a certain method for copying text only works on HTTPS, so when I tried that, it worked.
Sorry for the inconvenience and thanks! 🤭