Copy to Clipboard Button

Hi guys, I am using Power Grid CSV and need to put a copy to clipboard button on each row. So, there will be a bunch of different copy to clipboard buttons on the same page that copy different URLs to the clipboard. It is basically a directory list with different URL’s on each row. If you could take a look at this code and tell me what I am doing wrong? It keeps copying all the URLs in a loop. I just need it to copy the one associated with the button that was clicked. Thanks in advance!

Screen Shot 2020-12-23 at 3.26.08 PM

It would be easier to debug if you provided a URL to a test page so we could see the code in context.

You have a for loop grabbing all id’s 0 - 499, so it’s going to repeat until it gets them all or hits the condition < 500

My guess is you only want to grab the id of the button pressed?

UPDATE: I think my wife and I got it fixed!

@teefers Yes, I am needing to only pass the id of the pressed button. I just setup a test page so you can look at this code live. I have been searching all over for a fix to this. Your help is much appreciated! The test site is setup at http://ragainwebdesigns.com/testingpage/

1 Like

Parker (@Parker),

I was just checking it, and it seems to work for me on both mobile and desktop. Once you are sure it’s working, it would be nice if you posted the resulting code you used. It appears to be quite different then above.

3 Likes

Thanks for trying the code. It does seem to be working. Here is the code I ended up using. Hopefully this will help someone else. For those that will use this in RW, you do not need to include the script tags as RW creates those for you in the javascript pane.

working copy button code

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.