I'm copying some text to the clipboard using JS: ZeroClipboard. This text which I'm copying is inside a <div>
tag, and contains HTML formatting. It's working, but when I'm copying the text, the HTML tags get copied as they are! What I want is something on the client side that gives me formatted text, and I'm currently getting unformatted text. Please help!
Code:
var clip = new ZeroClipboard.Client();
clip.addEventListener('mousedown', function () {
clip.setText(document.getElementById('oSource').innerText);
});
clip.addEventListener('complete', function (client, text) {
alert('copied: ' + text);
});
//glue it to the button
clip.glue('Button1');
clip.glue('Button2');
I know it's similar to this question, but here he's used createTextRange,not ZeroClipBoard
I had to use the flash file Zeroclipboard10.swf for it to copy rich text. It worked when I added this line.
ZeroClipboard.setMoviePath("ZeroClipboard10.swf");