Reputation: 173
I'm having the luck of having to work with multiple contenteditable divs instead of textareas. I fixed almost everything, but can't find a way to completely disable pasting into the div:
$(document).on('paste',function(e) {
e.preventDefault();
});
The paste-event does fire, but the text still gets pasted. This only has to work on Chrome (latest). Does anyone have a solution?
Upvotes: 3
Views: 2310
Reputation: 914
You just need to return false
$(document).on('paste',function(e) {
e.preventDefault();
return false;
});
Upvotes: 4
Reputation: 402
try to change document
with div
$('div').on('paste',function(e) {
e.preventDefault();
});
Upvotes: 1