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 "https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=how+to+copy+text+by+click+on+text+in+php"
And I am showing like "https://www.google.co.in/webhp...."
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 (https://clipboardjs.com/).
And with this library you can add link with special
data-clipboard-text
attribute. From documentation:So you can add element with text
https://www.google.co.in/webhp....
and setdata-clipboard-text
to your full URL that you want to copy.You can use it simply by adding this code:
Here is fiddle.