How to detect Ctrl+V, Ctrl+C using JavaScript?

前端 未结 17 2136
走了就别回头了
走了就别回头了 2020-11-22 13:47

How to detect ctrl+v, ctrl+c using Javascript?

I need to restrict pasting in my textareas, end user should not copy and p

17条回答
  •  面向向阳花
    2020-11-22 14:43

    Live Demo : http://jsfiddle.net/abdennour/ba54W/

    $(document).ready(function() {
    
        $("#textA").bind({
            copy : function(){
                $('span').text('copy behaviour detected!');
            },
            paste : function(){
                $('span').text('paste behaviour detected!');
            },
            cut : function(){
                $('span').text('cut behaviour detected!');
            }
        });
    
    }); 
    

提交回复
热议问题