我正在寻找一种方法来清理粘贴到浏览器中的输入,这可以用jQuery实现吗?
到目前为止,我已经想出了这个:
$(this).live(pasteEventName, function(e) {
// this is where i would like to sanitize my input
return false;
}
不幸的是,由于这个"小"问题,我的发展受到了尖锐的阻碍.
我正在寻找一种方法来清理粘贴到浏览器中的输入,这可以用jQuery实现吗?
到目前为止,我已经想出了这个:
$(this).live(pasteEventName, function(e) {
// this is where i would like to sanitize my input
return false;
}
不幸的是,由于这个"小"问题,我的发展受到了尖锐的阻碍.
我使用以下代码对其进行了某种程度上的修复:
$("#editor").live('input paste',function(e){
if(e.target.id == 'editor') {
$('<textarea></textarea>').attr('id', 'paste').appendTo('#editMode');
$("#paste").focus();
setTimeout($(this).paste, 250);
}
});
现在我只需要存储插入符号的位置并附加到该位置,然后我就全部设置好了…我认为:)