Delete text from copied text

Posted by riddle on Stack Overflow See other posts from Stack Overflow or by riddle
Published on 2010-05-08T11:40:56Z Indexed on 2010/05/08 11:48 UTC
Read the original article Hit count: 243

Filed under:
|
|

Hello,

I would to use JavaScript to clean up text that’s being copied from my site.

I use snippets like this:

body {
    vertical-align: middle; ?
}

Where ? indicates comment later on. I want readers to copy this snippet and use it – so I need to delete that Unicode marker. How can I access text that’s being copied and make changes to it?

I considered deleting marker(s) from snippet when user clicks (mousedown) on it, so she could select the text, copy it and then I would restore markers but it seems a really long way to do it.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about copy