Questions tagged [clipboard.js]

Clipboard.js is a modern approach to copy text to clipboard. It doesn't depend on Flash. It has no dependencies. And it's just 2kb gzipped.

Copying text to the clipboard shouldn't be hard. It shouldn't require dozens of steps to configure or hundreds of KBs to load. But most of all, it shouldn't depend on Flash or any bloated framework. That's why clipboard.js exists.

137 questions
29
votes
10 answers

How do I copy to clipboard in Angular 2 Typescript?

Is there a way to copy text in clipboard (multi-browser) in Angular2 Typescript framework? I find only sources of using Javascript, e.g. document.execCommand('copy')
Andris Krauze
  • 2,092
  • 8
  • 27
  • 39
27
votes
2 answers

Tooltips + Highlight Animation With Clipboard.js Click

I've successfully installed clipboard.js and have gotten snippets of text to copy to the clipboard upon click. I'm going to be nesting these snippets of text (or the "btn"s they're within) in the cells of a table. My challenge: I need the snippets…
PercentSharp
  • 486
  • 1
  • 5
  • 16
24
votes
7 answers

Tooltip on click of a button

I'm using clipboard.js to copy some text from a textarea, and that's working fine, but I want to show a tooltip saying "Copied!" if it was successfully copied like they do in the example given on their website. Here's an example of it working…
user5368737
  • 793
  • 3
  • 12
  • 20
11
votes
3 answers

can't get "clipboard.js" to work

I can't get the clipboard.js to work; I think it's a simple "misunderstanding" about how the whole thing works, since I'm not even able to get the most simple example to work properly like in this Fiddle... My specific problem is getting this to…
marS
  • 379
  • 2
  • 3
  • 12
10
votes
2 answers

Custom select function with copy to clipboard pure JS

The current code appends a button to quickly select some code in a
 tag. What I want to add is the ability to copy that content to the clipboard and change the button text to "copied". 
How can I achieve it by modifying the current working code…
user2513846
  • 1,151
  • 2
  • 16
  • 39
8
votes
2 answers

Copy span text using Clipboard.js

I'm using clipboard.js and need to copy the text in a span by clicking a button. Is there a way to do this? HTML: text here
Rose
  • 363
  • 1
  • 3
  • 13
8
votes
1 answer

Using document.execCommand('copy') in mobile

Is there a way to copy to mobile clipboard? I've been researching for days but haven't found a good solution. Clipboard.js doesn't seem to work on mobile, giving me an error "no support :(" I'm currently using the following function: function…
Jackson Cunningham
  • 4,973
  • 3
  • 30
  • 80
7
votes
2 answers

elm: copy text to clipboard

Is there a way to copy a text from a div to clipboard when user clicks a button in elm 0.18? I have looked at Clipboard.elm but I cannot make it compile and work in elm 0.18. So is there an official working way to do this in elm 0.18?
Buda Gavril
  • 21,409
  • 40
  • 127
  • 196
7
votes
3 answers

How to use clipboard.js

As you may surmise from this question, I'm not very good with javascript and am trying to get clipboard.js (https://clipboardjs.com/) working but can't. I followed instructions by copying clipboard.min.js into the scripts folder and then referenced…
BMills
  • 881
  • 1
  • 10
  • 24
6
votes
1 answer

Bind Clipboard JS event to button after using jQuery load/Ajax function

I am using the ClipboardJS library to copy text that is attached to a button using the data-clipboard-text attribute. I am also using jQuery's .load() function to dynamically pull in HTML content. This content includes copies of the Copy text…
Mike Hermary
  • 346
  • 7
  • 22
6
votes
7 answers

Clipboard.js not working in Bootstrap modal

I am trying to copy an input value with Clipboard.js: https://clipboardjs.com/. The input is located in a modal: http://codepen.io/Deka87/pen/eBJOKY new Clipboard('#copy', { text: function(trigger) { return $("#copy-input").val(); …
sdvnksv
  • 9,350
  • 18
  • 56
  • 108
6
votes
3 answers

Bootstrap modal does not work with Clipboard.js (on Firefox)

I have a button on a bootstrap modal which is supposed to copy some data (shown in the modal) to clipboard (with clipboard.js). Modal seems to not support this action. When the button, which triggers the event described above, is out of the modal it…
dropdown
  • 95
  • 2
  • 8
4
votes
1 answer

How can I use clipboard.js with importmap in rails 7

I want to add a Copy to Clipboard button to my page in a Ruby on Rails 7 project. config/importmap.rb: pin "clipboard.js", to: "https://cdn.jsdelivr.net/npm/clipboard@2.0.10/dist/clipboard.min.js", preload:…
4
votes
1 answer

How to import Clipboard.js library into Google App Script?

Since manipulating clipboard is forbidden in Google App, I want to find a workaround by using Clipboard.js library. My questions are: 1. How should I import a Clipboard.js library to Google App Script? 2. And how to call the functions in other pages…
4
votes
1 answer

Can only get copy to clipboard on second click

What I'm doing I'm using clipboard.js to copy a URL to the clipboard. So I start by rendering some HTML in PHP. The code looks something like this: $copyToClipboard = "copyToClipboard(".$id.");"; echo "
Michael Yaworski
  • 13,410
  • 19
  • 69
  • 97
1
2 3
9 10