0

I have tried to prevent user to copy + paste or ctrl + v into text area. And it works. But I think some user try to find another way, so they can paste text into text area. They are using this way, by blocking text, then drag it into text area.

Smart way to hack this form, paste still can be done even I have disable it using:

$("#room").live("cut copy paste",function(e){
                e.preventDefault();
                });

Is there any way to disable paste?


here is how to paste without press ctrl + v or right click then paste enter image description here

How to disable drag and drop paste?

4
  • @Scimonster: I do this to prevent mistyping,cause this form is a report.
    – nunu
    Apr 17, 2014 at 5:23
  • Use return false instead of e.preventDefault() if it doesn't affect your code.
    – K K
    Apr 17, 2014 at 5:25
  • What's wrong with pasting though? Pasting can often be more accurate.
    – Scimonster
    Apr 17, 2014 at 5:30
  • my script can work. no problem. but we can paste it without press ctrl + v or right click then paste. you can do paste by blocking text then drag into your form. that is what i want to prevent.
    – nunu
    Apr 17, 2014 at 6:26

1 Answer 1

0

http://jsfiddle.net/9E3wy/

$('textarea').on('copy paste cut', function () {
    return false;
});

Used return false instead of e.preventDefault();

2
  • my script is no problem, see my comment above.
    – nunu
    Apr 17, 2014 at 6:28
  • I have tried to your jsfiddle but paste using drag and drop still can do.
    – nunu
    Apr 17, 2014 at 6:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.