Add

Lorem ipsum

Lorem ipsum

A
A
A
Design

5 views

4 min

How to Copy Text to the Clipboard in Webflow

Learn how to add a “Copy” button in Webflow to copy text to the clipboard with the Clipboard API.

In this tutorial, Sandro, cofounder of Gemeos Webflow agency, shows you how to add a “Copy” button to copy text to the clipboard from Webflow.

Example

Click to copy

https://gemeos.wf/academie/copy-to-clipboard-webflow

ID / ClassElementRole
copy-textText Block or DivContent to copy
copy-btnLink Block or ButtonTrigger button
copy-feedbackText BlockConfirmation message

1. Create the elements in Webflow

Create a Text Block with the ID copy-text containing the text to copy. Add a button with the ID copy-btn. Optional: add a Text Block with the ID copy-feedback showing “Copied!” with display set to none by default.

2. Add this script in the <body>

document.getElementById('copy-btn').addEventListener('click', function() {
const text = document.getElementById('copy-text').textContent;
navigator.clipboard.writeText(text).then(function() {
const feedback = document.getElementById('copy-feedback');
if (feedback) {
feedback.style.display = 'block';
setTimeout(function() { feedback.style.display = 'none'; }, 2000);
}
});
});

3. Publish and test

Click the button: the text is copied and the “Copied!” message appears for 2 seconds. If you want to copy an input field, replace .textContent with .value.

good to know

The navigator.clipboard.writeText() API requires HTTPS to work. In Webflow preview (on webflow.io), it works. On a custom domain, make sure your SSL certificate is active. On older browsers without Clipboard API support, use document.execCommand('copy') as a fallback.

Conclusion

The copy button improves UX for technical content. Use cases:

  • Copy a promo code on a landing page
  • Copy a code snippet in a tutorial
  • Copy a referral link

Good to know

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum dolor sit amet consectetur. Aliquam orci sagittis dignissim sapien praesent donec.

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...