Domanda

I am trying to use the zClip jQuery plugin (http://www.steamdev.com/zclip/#features) and am wanting to copy an attribute of the link that is being clicked on.

Essentially I need to copy a URL to the clipboard on click, but its not working.

$('a.activation_copy_link').zclip({
  path: "<%= asset_path('ZeroClipboard.swf') %>",
  copy: $(this).data('link')
});

HTML Markup:

<a href="#" class="activation_copy_link" data-link="activation_url_here">Click to copy link</a>

I understand that the $(this) will refer to the zclip object and not the jQuery object, but I have tried everything I can think of and it's not working.

È stato utile?

Soluzione

$('a.activation_copy_link').each(function() {
  var $this = $(this);
  $(this).zclip({
  path: "<%= asset_path('ZeroClipboard.swf') %>",
  copy: $this.data('link')
});

});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top