How to copy string by clicking on string?

How can I copy string by clicking on string. I have URL field which contain very long string in my table so I am showing that string by on 30 character. ex. Full string like ""

And I am showing like ""

So when I clicked on that string. I want to copy that full string so I can paste it anywhere.

Answers 1

  • You can try clipboard.js (

    And with this library you can add link with special data-clipboard-text attribute. From documentation:

    Truth is, you don't even need another element to copy its content from. You can just include a data-clipboard-text attribute in your trigger element.

    So you can add element with text and set data-clipboard-text to your full URL that you want to copy.

    You can use it simply by adding this code:

        new Clipboard('.trigger');

    Here is fiddle.

Related Articles