指引网

当前位置: 主页 > 网页制作 > JavaScript >

js检测复制、粘贴与剪切操作

来源:网络 作者:佚名 点击: 时间:2017-08-07 22:14
[摘要] 利用jQuery,大家可以非常轻松地检测到选定元素的复制、粘贴与剪切操作。
利用jQuery,大家可以非常轻松地检测到选定元素的复制、粘贴与剪切操作。

  1. $("#textA").bind('copy'function() {  
  2.   
  3.     $('span').text('copy behaviour detected!')  
  4.   
  5. });  
  6.   
  7. $("#textA").bind('paste'function() {  
  8.   
  9.     $('span').text('paste behaviour detected!')  
  10.   
  11. });  
  12.   
  13. $("#textA").bind('cut'function() {  
  14.   
  15.     $('span').text('cut behaviour detected!')  
  16.   
  17. });  

------分隔线----------------------------