开发者

capture paste event / pasted html - javascript

开发者 https://www.devze.com 2023-02-27 19:12 出处:网络
I\'d l开发者_如何学编程ike to capture the pasted html in both mozilla and ie and then, before the paste event occurs, I\'d like to modify it. Any suggestions? You can do it, but it\'s hacky. You have

I'd l开发者_如何学编程ike to capture the pasted html in both mozilla and ie and then, before the paste event occurs, I'd like to modify it. Any suggestions?


You can do it, but it's hacky. You have to essentially redirect the paste to an off-screen element. Here's my answer to a similar question: JavaScript get clipboard data on paste event (Cross browser)


Here's a small - neat - jQuery snippet for the capturing Cut/Copy/Paste events:

$("#Text1").bind('cut copy paste', function(e) {
    alert(e.type + ' text!'); //Alerts the Cut/Copy/Paste event        
});

Source: http://www.devcurry.com/2009/07/detect-copy-paste-and-cut-operations-on.html

0

精彩评论

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