Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:08:41+00:00 2026-06-17T05:08:41+00:00

If this cant be done for cross-browser, then any comments would be much appreciated.

  • 0

If this cant be done for cross-browser, then any comments would be much appreciated.

What I am trying to achieve is multiple “copy to clipboard” links on my page like this for example…

<a href="#" data-copy="<?php echo $original[0]; ?>" class="copy">Copy Original Link</a>
<a href="#" data-copy="<?php echo $medium[0]; ?>" class="copy">Copy Medium Link</a>
<a href="#" data-copy="<?php echo $web[0]; ?>" class="copy">Copy Web Link</a>

Just not really having much luck getting anything to work.

I am using zClip, and trying to fire using jQuery onClick and a data attribute, like below.

But just cannot get it to work. See fiddle.

var copyText = 0;

$("a.copy").on('click', function () {

  var copyText = $(this).attr('data-copy');
  return false;

}).each(function () {

  $(this).zclip({

    path: 'http://zeroclipboard.googlecode.com/svn-history/r10/trunk/ZeroClipboard.swf',
    copy: copyText,
    beforeCopy: function () {

    },
    afterCopy: function () {

      alert(copyText + " has been copied!");

    }

  });

});

Please see my new fiddle here with zClip jquery plugin being used.

http://jsfiddle.net/Vr4Ky/5/

Thank in advance for any suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:08:43+00:00Added an answer on June 17, 2026 at 5:08 am

    Here is an updated demo that does what you are trying to do:

    Using this (the same) HTML:

    <a href="#" data-copy="http://test.one.com/" class="copy">Copy Original Link</a>
    <br />
    <a href="#" data-copy="http://test.two.com/" class="copy">Copy Medium Link</a>
    <br />
    <a href="#" data-copy="http://test.three.com/" class="copy">Copy Web Link</a>
    

    This script should work:

    $("a.copy").on('click', function (e) {
      e.preventDefault();
    }).each(function () {
      $(this).zclip({
        path: 'http://www.steamdev.com/zclip/js/ZeroClipboard.swf',
        copy: function() {
          return $(this).data('copy');
        }
      });
    });
    

    Here is what I did. First off the alert that you were adding via afterCopy is actually the default, so you don’t need to add extra code for that. Also the data-copy attributes should be accessed via jQuery’s data function. Finally I put the SWF reference to the same host as the JavaScript (this might not be necessary depending on the
    security code in the SWF but it seemed necessary to get the jsfiddle to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sure I've seen this done before but off-hand I can't find any examples. I've
I cant believe this, i always throught the below would be concurrency safe. I
Cant get this script to work with my menu really have tried everything any
I'm trying to (cross-)compile node.js and I get this odd error that appears to
I need to center text in a select list cross device and browser. This
I have css like this: .done {list-style-image:url('images/tick.gif')} .notdone {list-style-image:url('images/cross.gif')} And html like this: <ul>
I've done some searching, but can't seem to find a way to do this.
I know I've done this before years ago, but I can't remember the syntax,
I believe I've done this before, but I can't seem to remember how:( HttpWebRequest
Been searching all over for this but cant find an answer so thought I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.