JavaScript - - By Sam Deering

jQuery Capture Copy, Paste and Cut Events

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

Demo

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


The Code

(function($)
{
    $(document).ready(function() {

        $("#textinput").bind({
            copy : function(){
                $('#eventresult').text('copy behaviour detected!');
            },
            paste : function(){
                $('#eventresult').text('paste behaviour detected!');
            },
            cut : function(){
                $('#eventresult').text('cut behaviour detected!');
            }
        });

    });
})(jQuery);
Sponsors
Login or Create Account to Comment
Login Create Account