<span>(function($) </span><span>{ </span> <span>$(document).ready(function() { </span> <span>$("#textinput").bind({ </span> <span>copy : function(){ </span> <span>$('#eventresult').text('copy behaviour detected!'); </span> <span>}, </span> <span>paste : function(){ </span> <span>$('#eventresult').text('paste behaviour detected!'); </span> <span>}, </span> <span>cut : function(){ </span> <span>$('#eventresult').text('cut behaviour detected!'); </span> <span>} </span> <span>}); </span> <span>}); </span><span>})(jQuery);</span>
$(“#yourelement”)。on('paste',function(e){
//您的代码在此处
});
在此代码中,#yourelelement是HTML元素的ID,您希望将Paste Event绑定到Paste Event。每当在该元素上发生糊状事件时,.on()方法内的功能将执行。
>我如何获取jQuery中的粘贴事件的内容?
$(“#yourelemt”)。on('paste',function(e){
var pasteddata = e.originalevent.clipboarddata.getData.getData('text'''text'')粘贴。
jQuery?
>中的clone()方法是什么?以下是一个示例:
我如何捕获Jquery中的剪切事件?您可以使用.on()方法将切割事件绑定到元素。以下是一个示例:
});
>
在此代码中,.on(.on()方法内的函数都会在该元素上发生剪切时执行。 jQuery,您可以使用.on()方法将复制事件绑定到元素。这是一个示例:
$(“#yourelement”)。on('copy',函数(e){
//您的代码在此处
以上是jQuery捕获副本,粘贴和剪切事件的详细内容。更多信息请关注PHP中文网其他相关文章!