I was able to create a simple web-page that uses clipboard.js with a button that pastes predefined text using the
data-clipboard-text="Just because you can doesn't mean you should — clipboard.js"
property as the documentation at the clipboard.js site shows, but now I want to place some text in a <span>
tag and copy it when this text is selected.
However, I don't know how to 'tie' the data-clipboard-action="copy" data-clipboard-target="span"
properties to a <span>
tag and cause it to copy the <span>
's content with the onselect event.
Are there procedural statements that I can use in javaScript to perform the copying and pasting functions?
My goal is to embed code to copy selected text into the HTML part of an email and allow the recipient of the email to simply copy the selected text to the clipboard so that it can then be pasted from the clipboard into an input text box in a web-application's page.
This would simplify copy/paste on touch-screen devices, such as tablets and cell-phones.