How can I create a button that copies text to clipboard?

How do I code a button that will copy specific text to the clipboard?

For example:

DISCOUNTCODE

, customer will click on the button, and the

DISCOUNTCODE

will be copied to the user clipboard so he/she can paste it on checkout.

Hello, I was working on a similar issue, so I thought I would post my solution. I used java to create a citation for blog articles. I am unsure where you will use your code but this may help if you are in the liquid.


your conent to be copied

Copy

You can see an example of it here at the bottom of the page https://vincenttriola.com/blogs/ten-years-of-academic-writing/hr-s-role-in-public-private-sector

Did you figure this out? I need this as a possible workaround for Dawn’s silly placement of the discount code prompt in checkout.

1 Like