Forum Academy Marketplace Showcase Pricing Features

Copy text from repeating group to clipboard

I would like to share my solution how to copy text from repeating groups to clipboard.

  1. Add this script into page header section
<script>
function copyToClipboard(element) {
var $temp = $("<input>");
   $("body").append($temp);
   $temp.val($(element).text()).select();
   document.execCommand("copy");
   $temp.remove();
   }
</script>
  1. Create repeating group and add HTML element in to cell

    Comment: I’ve added p infront of Current cell’s index just in case if I’ll have several fields to copy. Add whatever dynamic text you wish.

  2. Create another HTML element in first cell

You can even make first HTML element hidden.

I hope someone will find this tip helpful.

10 Likes

This is cool! Thank you @petrucho :slight_smile:

Great tip, thanks for sharing!

</script> at the end saves you some grief :slight_smile:

I have created an example on buildingonbubble if anyone needs it. This adds the css styling for the button too.

https://buildingonbubble.com/block/copy-to-clipboard-1493386877718x846040262164348900

1 Like

@NigelG thank you very much… I’m not sure if it’s my browser but…

Thanks, yes the HTML breaks the page it seems :frowning:

Pardon me. There was a typo in original message.
Now it’s fixed.

Typo or not, it was a great suggestion so thank you :slight_smile:

This is great stuff. One question though: I’m using a multiline input and on copy it eliminates spaces and enters. Can it also copy that info so paragraphs are preserved?