copy an element as HTML to clipboard

Posted by Brian Scott on Stack Overflow See other posts from Stack Overflow or by Brian Scott
Published on 2010-05-26T12:10:59Z Indexed on 2010/05/26 12:21 UTC
Read the original article Hit count: 275

Filed under:
|
|
|
|

I've managed to write some jQuery to find an element and copy it's html to the clipboard (ie only).

The problem is that when I paste this into a rich text box area in sharepoint it pastes the HTML as text only.

How do i replicate the user action of highlighting a link on a page and pressing copy. When I do this manually and then paste the clipboard contents the rich text area realises that it is markup and replicates the link as an anchor in the text content.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery