By Sam Deering

jQuery Capture Copy, Paste and Cut Events

By Sam Deering

This is how you can capture if someone has copied, cut or pasted into a input text area.



Copy, cut or paste text from/to the text area below.

The Code

    $(document).ready(function() {

            copy : function(){
                $('#eventresult').text('copy behaviour detected!');
            paste : function(){
                $('#eventresult').text('paste behaviour detected!');
            cut : function(){
                $('#eventresult').text('cut behaviour detected!');

  • mahesh

    ur post is nice….but i need the code how to cut,copy and paste …….i am designing my own right click context menu in that i would like to put these 3 things …..can u please send the code to mail …

  • Vinicius

    Ok, but does the input event solve the same problem?

    $(“#textinput”).on(‘input’, function(){ $(‘#eventresult’).text(‘INPUT behaviour detected!’); });

  • Soumik

    Well its a nice code to track copy event , can u tell me what would be the code to trigger copy functionaly of a component when used in mobile

Get the latest in JavaScript, once a week, for free.