catch paste event?

Hi, how can I catch event that "sth paste into a textbox"?
I tried onchange , but unless I move cursor after doing paste,
it doesnot get triggered.
Who is Participating?
ozymandiasConnect With a Mentor Commented:
You can catch the ctrl-v key stroke like this :

<script language="javascript">

var ctrlModifier = false;

function checkKeyDown(){
     var keyCode = window.event.keyCode;
     if (keyCode == 17){
          ctrlModifier = true;

function checkKeyUp(){
     var keyCode = window.event.keyCode;
     if (keyCode == 17){
          ctrlModifier = false;
     if (keyCode == 86 && ctrlModifier){
          alert("You just pasted");
<input type="text" onKeyDown="checkKeyDown()" onKeyUp="checkKeyUp()">


Try pasting into this field now.
I'm not sure how you catch the paste from the context menu though. You could always disable it though.
I don't think there is any event handler for paste.
Try using onKeyUp event.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.