0

I have an Email address in my page and I want when user clicks on it, then the Email address would be copied to the clip board and with small alert(like attached) it shows user in a small label near the box that it copied to clipboard,

I used https://clipboardjs.com/ to implement my goal. it copied to clipboard fine, but the problem is that it doesn't show user that it copied to clipboard after clicks on it,

enter image description here

my code if needed:

javascript

  new Clipboard('.btn');

html

<button class="btn" data-clipboard-text="test@test.com">
                        test@test.com
</button>

Appreciate any suggestion

neda Derakhshesh
  • 1,103
  • 2
  • 20
  • 43

1 Answers1

1

Actually, the tooltip is not a part of the clipboard.js. If you look at the source code of the page, you can see that tooltip.js is been added and configured in demo.js.

All you need to do is add a tooltip library or function just like the demo page and use it on button click.

Hope it helps.

Aslam
  • 9,204
  • 4
  • 35
  • 51
  • thank you, its correct. would you mind if suggest me a tool tip library to add in my project? – neda Derakhshesh Feb 20 '17 at 09:36
  • You can just use the one the demo clipboardjs website is using. It is a simple one. And if my answer helped you, Please don't' forget to select it as the Answer :) – Aslam Feb 20 '17 at 09:40
  • 1
    this link was helpful and also thank you to guide me there. http://stackoverflow.com/questions/37798967/tooltip-on-click-of-a-button – neda Derakhshesh Feb 20 '17 at 10:19