Copy text on image click
I want to be able to copy a string of code when you click on an image I have. I tried a simple script to make it happen but it doesn't seem to work. Are there any errors or issues with my code that would prevent this from working? <script> function copyButton() { navigator.clipboard.writeText( '<a href="https://anerdyartists.nekoweb.org/"> <img src="https://files.catbox.moe/arcv7q.gif" style="image-rendering: pixelated;"> </a>'); alert("Code Copied"); } </script> <center> <img src="https://files.catbox.moe/arcv7q.gif" style="image-rendering: pixelated;" onclick="copyButton()"> </center>
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.