Colby77
Colby77

Reputation: 617

Detecting html textarea's change

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 occur only when the user click with the left mouse button on the textarea.

How can I handle this situation?

Upvotes: 9

Views: 8072

Answers (1)

Glennular
Glennular

Reputation: 18215

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!');
});

Upvotes: 10

Related Questions