How can I get the text that is going to be pasted in my html text editor?

前端 未结 2 1710
时光取名叫无心
时光取名叫无心 2021-01-14 00:59

I have a small text editor in my home page ( a textarea ) where I can paste text. How can I get this text in a variable before it would be pasted? I know that there is this

2条回答
  •  自闭症患者
    2021-01-14 01:22

    Getting the clipboard to work across all browsers is tricky and I believe it's safe to assume there's no way to make it work with only JavaScript, unless you're targeting one specific browser (usually IE). I used ZeroClipboard for this: http://code.google.com/p/zeroclipboard/ - it seems to do its job OK.

提交回复
热议问题