jQueryでコピー、貼り付け、切り取りの動作を検出する方法
コピー、貼り付け、切り取りの動作を検出するには、対応するイベントタイプをバインドするだけです。
$("#textA").bind('copy', function() {
$('span').text('copy behaviour detected!')
});
$("#textA").bind('paste', function() {
$('span').text('paste behaviour detected!')
});
$("#textA").bind('cut', function() {
$('span').text('cut behaviour detected!')
});
jQuery 1.4xを使用している場合、次のような複数イベント宣言をサポートしています。
$("#textA").bind({
copy : function(){
$('span').text('copy behaviour detected!');
},
paste : function(){
$('span').text('paste behaviour detected!');
},
cut : function(){
$('span').text('cut behaviour detected!');
}
});