I want to copy the contents of asp: label using javascript.
I can do this using this method:
strContent = document.getElementById('MainContent_lblHtml').innerText;
window.clipboardData.setData("Text", strContent);
but it removes the formatting and just copies the text. (I assume that dataformat is set to "text".)
The label contains some formatted html. I want to save the format, getting the same effect as if I selected it on the screen with the mouse, and then copied (for example) a document with text.
source
share