I remember doing something similar in the past, but I can't seem to find any information about it now. It's proving to be quite difficult to research this particular issue.
What I want to achieve is showing one version (A) of text on the screen, but when that text is copied, a different version (B) is actually copied to the clipboard. A and B could be similar or entirely different strings.
For instance, if I use a <div>
element to display the following to the user:
<div>This is a really long...</div>
...and the user selects the div and copies it, I would like the text placed on the clipboard to be:
This is a really long bit of text that is too large to display on-screen, but should be fully intact when copy/pasted.
(Of course, my application would take care of shortening the displayed string and adding ellipses.)
I have a feeling this can be achieved with simple HTML/CSS, but the specifics are escaping me at the moment. Any thoughts?