C
C
caution2014-02-18 00:07:49
Ruby on Rails
caution, 2014-02-18 00:07:49

How to implement copy to clipboard by Rails link?

Need ideas or practical tips on how to implement copy-to-clip-by-reference for multiple elements.
I tried zeroclipboard-rails, it doesn't work with it.
Did it exactly like this:

<button class='my_clip_button' data-clipboard-target='fe_text' data-clipboard-text='Default clipboard text from attribute' id='d_clip_button' title='Click me to copy to clipboard.'>
    <b>Copy To Clipboard...</b>
  </button>
  <span id="fe_text"><%= model.link %></span>

<script>
  $(document).ready(function() {
    var clip = new ZeroClipboard($(this).("#d_clip_button"))
  });

  $("#clear-test").on("click", function(){
    $("#fe_text").val("Copy me!");
    $("#testarea").val("");
  });
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Burmakin, 2014-02-18
@Freika

As far as I know, copy-on-click is almost everywhere implemented through Flash. Google on this topic, JS, most likely, will not help you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question