开发者

Detecting html textarea's change

开发者 https://www.devze.com 2022-12-30 09:25 出处:网络
I\'d like to monitor my textarea\'s changes with jQuery. I can do this with the keyup event and it works perfectly. But what event I can get when a user click on the textarea (right mouse click), then

I'd like to monitor my textarea's changes with jQuery. I can do this with the keyup event and it works perfectly. But what event I can get when a user click on the textarea (right mouse click), then choose paste?

Click event oc开发者_Go百科cur only when the user click with the left mouse button on the textarea.

How can I handle this situation?


you can detect Pastes or Cuts into the textarea by:

$("#TextBox1").bind('paste', function(e) {
            alert('pasting text!');
        });
$("#TextBox1").bind('cut', function(e) {
            alert('cut text!');
        });

Or combine:

$("#Text1").bind('cut paste', function(e) {
    alert(e.type + ' text!');
});
0

精彩评论

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