Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$clipboard(dataelement) gives writeText error #12

Closed
ralphjsmit opened this issue Mar 25, 2021 · 1 comment
Closed

$clipboard(dataelement) gives writeText error #12

ralphjsmit opened this issue Mar 25, 2021 · 1 comment

Comments

@ralphjsmit
Copy link

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!

Schermafbeelding 2021-03-25 om 16 52 32

@ralphjsmit
Copy link
Author

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! 🤭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant