开发者

Javascript Clean copied data from html tag

开发者 https://www.devze.com 2023-01-09 00:32 出处:网络
I make a small web application that retrieve data and my clients copy information in the web page and paste data in excel

I make a small web application that retrieve data and my clients copy information in the web page and paste data in excel

the problem is that copied data contains "html" elements about style or i don't know what and if users make a basic copy/paste it block macro in the excel document

If they copy data and paste in a notepad, re-copy and paste it will work, because, it remove unwanted data

searching on the internet, I found that, but it does not do what I want,

the idea is that when an user copy data the javascript "clean" the copied text and then no more issue

Delete text from copied text

How do you handle oncut, oncopy, and onpaste in jQuery?

http://www.ht开发者_开发百科mlgoodies.com/beyond/javascript/article.php/3458851/Click-Its-Copied.htm


You could put the text into the inner text of a <textarea> tag. Then, no formatting information will follow text when it's copied.

<textarea rows="4" cols="40">
  Text to be copied.
</textarea>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号