Capture Copy/Paste/Select in Javascript

asp.net, javascript

Solution

Use the `select`, `copy` and `paste` events respectively. Pretty much universally supported these days.

var textBox = document.getElementById("textBoxId");
textBox.onpaste = function() {
    alert("paste");
};

Likewise for the other events. Demo here: http://jsfiddle.net/timdown/EC2Hf/

Problem

How can i capture the following keys in `Textbox` using `JavaScript`? Ctl + a Ctl + c Ctl + v Following is the original Situation. I have three `Textboxes` for Phones numbers. `Textbox1` max length is 3 , 2nd's is 3 and 3rd is 4. When user types three digits in `TextBox1` the cursor moves automatically to `TextBox2` same thing happens with TextBox2 as well as TextBox3. I am handling this functionality in keyup event. Now, I am parallely using your code. But it moves in keyup event as well. This case happens when all TextBoxes are filled. Now suppose I am in TextBox1 and presses Ctl + A . This moves the user to third TextBox(unacceptable case). This is the issue.

Original source

Related problems